From d7c1b5874dcb3b4242c8d905255cf3c07cd7f877 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 9 Mar 2006 19:14:37 +0000 Subject: Fix memory leak in list.c --- common/list.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'common/list.c') 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; } -- cgit