Listing 3

 1:
 2: /*
 3:  * Function:         alloc_rec
 4:  * Purpose:             Allocate memory for a Database record,
 5:  *                           checking for an allocation error
 6:  * Parameters:         None
 7:  * Return Value:     Pointer to memory, or NULL on error
 8:  */
 9:
10: struct record *alloc_rec(void)
11: {
12:     struct record *temp;
13:
14:     if ((temp = malloc(sizeof(struct record))) == NULL)
15:         return NULL;
16:     else
17:         return temp;
18: }
19: