From 1b9d84f52ad32c10edec5df8b8aeb8b2c6cae720 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Sun, 1 Jul 2012 07:14:42 +0200 Subject: [PATCH] l_sort: fix tiny memory leak --- list.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/list.c b/list.c index bee2554..634780c 100644 --- a/list.c +++ b/list.c @@ -226,13 +226,15 @@ list *l_init(void) void l_sort(list * l, int (*f) (void *, void *)) { - list *old_list = l_init(); + list *old_list; if (!l || l_length(l) < 2) { /* nothing to do */ return; } + old_list = l_init(); + old_list->head = l->head; l->head = NULL;