diff options
author | F. Aragon <paco@voltanet.io> | 2018-06-28 16:16:35 +0200 |
---|---|---|
committer | F. Aragon <paco@voltanet.io> | 2018-06-29 11:03:06 +0200 |
commit | 0866cdaf3e9f0ac0d779a14da69262c1fe8d54d9 (patch) | |
tree | 345210a040103ee660ee152be5cb2f57436b3c46 /lib/linklist.c | |
parent | Merge pull request #2563 from pacovn/Coverity_1465494_String_not_null_termina... (diff) | |
download | frr-0866cdaf3e9f0ac0d779a14da69262c1fe8d54d9.tar.xz frr-0866cdaf3e9f0ac0d779a14da69262c1fe8d54d9.zip |
bgpd: null check (Coverity 1453455)
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'lib/linklist.c')
-rw-r--r-- | lib/linklist.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/lib/linklist.c b/lib/linklist.c index 2cfa3e748..86649dd49 100644 --- a/lib/linklist.c +++ b/lib/linklist.c @@ -186,26 +186,10 @@ void listnode_move_to_tail(struct list *l, struct listnode *n) void listnode_delete(struct list *list, void *val) { - struct listnode *node; + struct listnode *node = listnode_lookup(list, val); - assert(list); - for (node = list->head; node; node = node->next) { - if (node->data == val) { - if (node->prev) - node->prev->next = node->next; - else - list->head = node->next; - - if (node->next) - node->next->prev = node->prev; - else - list->tail = node->prev; - - list->count--; - listnode_free(node); - return; - } - } + if (node) + list_delete_node(list, node); } void *listnode_head(struct list *list) |