diff options
-rw-r--r-- | common/list.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/list.c b/common/list.c index 1aa9d0be..bda2b564 100644 --- a/common/list.c +++ b/common/list.c @@ -74,13 +74,14 @@ struct slist *slist_remove(struct slist *list, void *data) return list; next = match->next; - match->next = NULL; + + free(match); /* If the head was removed, return the next element */ if (!prev) return next; - prev->next = match->next; + prev->next = next; return list; } |