Curl_llist_remove: fix potential NULL pointer deref

Fixes a scan-build warning.
This commit is contained in:
Daniel Stenberg 2017-11-20 22:59:19 +01:00
parent 46e852ce26
commit cec0734b4c
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 5 additions and 1 deletions

View File

@ -106,7 +106,11 @@ Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
e->next->prev = NULL;
}
else {
e->prev->next = e->next;
if(!e->prev)
list->head = e->next;
else
e->prev->next = e->next;
if(!e->next)
list->tail = e->prev;
else