/* Function prototype. */
void * check_malloc(size_t num_bytes);

/* Function definition. */
void * check_malloc(size_t num_bytes) {
  void *p = malloc(num_bytes);

  if(p == NULL) {
    /* Obviously change this error message if the project specifies something
     * particular. */
    printf("Error, couldn't allocate memory.\n");
    exit(-1);
  }

  return p;
}