aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-11-20 22:59:19 +0100
committerDaniel Stenberg <daniel@haxx.se>2017-11-21 09:02:40 +0100
commitcec0734b4c3a396d22e0c9e30f613d8255f431bf (patch)
tree2e8f815138d93d439aa2e9d34e5ab46cfa4e8b3e /lib
parent46e852ce26f0f5eeea54a6cac4680dc6a3315f73 (diff)
Curl_llist_remove: fix potential NULL pointer deref
Fixes a scan-build warning.
Diffstat (limited to 'lib')
-rw-r--r--lib/llist.c6
1 files changed, 5 insertions, 1 deletions
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