diff --git a/lib/list.c b/lib/list.c index 92207d0c..28d70986 100644 --- a/lib/list.c +++ b/lib/list.c @@ -77,7 +77,6 @@ list_insert_head(struct list_head *h, void *elem, struct list_entry *e) { list_check2(h, elem, e, false); if (h->first == NULL) { - e->next = NULL; h->tailnextp = &e->next; } else { uintptr_t offset = (uintptr_t)e - (uintptr_t)elem; @@ -85,9 +84,9 @@ list_insert_head(struct list_head *h, void *elem, struct list_entry *e) (void *)((uintptr_t)h->first + offset); assert(firstentry->prevnextp == &h->first); firstentry->prevnextp = &e->next; - e->next = h->first; - e->prevnextp = &h->first; } + e->next = h->first; + e->prevnextp = &h->first; h->first = elem; assert(h->first != NULL); assert(*e->prevnextp == elem);