From: Daniel Stenberg Date: Mon, 20 Nov 2017 21:59:19 +0000 (+0100) Subject: Curl_llist_remove: fix potential NULL pointer deref X-Git-Tag: curl-7_57_0~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cec0734b4c3a396d22e0c9e30f613d8255f431bf;p=curl Curl_llist_remove: fix potential NULL pointer deref Fixes a scan-build warning. --- diff --git a/lib/llist.c b/lib/llist.c index 4bb0a51b8..f8769c2af 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -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