aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--list-tail-node.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/list-tail-node.c b/list-tail-node.c
index 52b93ce..c939b8d 100644
--- a/list-tail-node.c
+++ b/list-tail-node.c
@@ -75,7 +75,10 @@ list_pop_front(struct list *list, T *data)
75{ 75{
76 if ( list->head != NULL ) { 76 if ( list->head != NULL ) {
77 struct list_node *next = list->head->next; 77 struct list_node *next = list->head->next;
78 *data = list->head->data; 78
79 if ( data != NULL ) {
80 *data = list->head->data;
81 }
79 free(list->head); 82 free(list->head);
80 list->head = next; 83 list->head = next;
81 84