diff --git a/lib/linklist.c b/lib/linklist.c index 8519482885..d1b57084ef 100644 --- a/lib/linklist.c +++ b/lib/linklist.c @@ -98,9 +98,10 @@ void listnode_add_head(struct list *list, void *val) node->next = list->head; - if (list->head == NULL) + if (list->head == NULL) { list->head = node; - else + list->tail = node; + } else list->head->prev = node; list->head = node;