summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 86ef268)
raw | patch | inline | side by side (parent: 86ef268)
author | Florian Forster <octo@collectd.org> | |
Wed, 17 Jun 2015 07:09:17 +0000 (09:09 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 17 Jun 2015 07:09:20 +0000 (09:09 +0200) |
This handles the following (unlikely) case:
(l->head == NULL) && (e == NULL)
In this case, the following code will dereference a NULL pointer:
if (l->head == e)
l->head = e->next;
(l->head == NULL) && (e == NULL)
In this case, the following code will dereference a NULL pointer:
if (l->head == e)
l->head = e->next;
src/utils_llist.c | patch | blob | history |
diff --git a/src/utils_llist.c b/src/utils_llist.c
index 6a0c6f06411b76e7fa15083bb1d5fd850c9d48f0..11f838d248f6ab799c53654569f683af07db6d2d 100644 (file)
--- a/src/utils_llist.c
+++ b/src/utils_llist.c
{
llentry_t *prev;
+ if ((l == NULL) || (e == NULL))
+ return;
+
prev = l->head;
while ((prev != NULL) && (prev->next != e))
prev = prev->next;