l_sort: fix tiny memory leak
This commit is contained in:
parent
f9885f38c4
commit
1b9d84f52a
4
list.c
4
list.c
@ -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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user