From cec0734b4c3a396d22e0c9e30f613d8255f431bf Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 20 Nov 2017 22:59:19 +0100 Subject: Curl_llist_remove: fix potential NULL pointer deref Fixes a scan-build warning. --- lib/llist.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3