l_sort: fix tiny memory leak

This commit is contained in:
Sascha Kruse 2012-07-01 07:14:42 +02:00
parent f9885f38c4
commit 1b9d84f52a

4
list.c
View File

@ -226,13 +226,15 @@ list *l_init(void)
void l_sort(list * l, int (*f) (void *, void *)) void l_sort(list * l, int (*f) (void *, void *))
{ {
list *old_list = l_init(); list *old_list;
if (!l || l_length(l) < 2) { if (!l || l_length(l) < 2) {
/* nothing to do */ /* nothing to do */
return; return;
} }
old_list = l_init();
old_list->head = l->head; old_list->head = l->head;
l->head = NULL; l->head = NULL;