When your code reaches line 96, what is the value of current->record_list? As far as I can see it's NULL, because program execution only reaches line 96 if current->record_list is NULL (see line 89; i.e. it's still NULL when line 96 is reached). You can't do
Code:
strcpy(current->record_list->c_detail1,record->c_detail1);
Because the part in bold must be NULL otherwise the line would never have been reached because execution only reaches line 96 if the part in bold is NULL (because of line 89).
Maybe before reaching line 96, and after line 89, you have to do something like
Code:
current->record_list = record_list;
(But don't quote me on that I haven't looked very closely at your code because I'm on a device that makes it difficult for me. That said you have to either add something like the line above or change lines 96-98 to use record_list rather than current->record_list or something else that is not NULL)
Edit: What I'm suggesting is either :
Code:
/* Check head of record list */
if (current->record_list == NULL) {
/* First record */
// printf("Record - detail: %s\n",record->c_detail1);
// printf("Record - value: %d\n",record->i_value);
record_list = (record_t *) malloc(sizeof(record_t));
current->record_list = record_list;
strcpy(current->record_list->c_detail1,record->c_detail1);
current->record_list->i_value = record->i_value;
current->record_list->next = NULL;
} /* current->record_list == NULL */
or
Code:
/* Check head of record list */
if (current->record_list == NULL) {
/* First record */
// printf("Record - detail: %s\n",record->c_detail1);
// printf("Record - value: %d\n",record->i_value);
record_list = (record_t *) malloc(sizeof(record_t));
strcpy(record_list->c_detail1,record->c_detail1);
record_list->i_value = record->i_value;
record_list->next = NULL;
}