mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 12:18:12 +00:00
lib: When adding to front of list ensure we handle tail to
When inserting to the front of a list with listnode_add_head if the list is empty, the tail will not be properly set and subsuquent calls to insert/remove will cause the function to crash. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
3e85fb3373
commit
e483855d24
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user