From 93174e167a6aa313fca43f4cb0e9b975e1618468 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 21 May 2021 22:41:11 +0200 Subject: Better window destroying --- libs/libc/list.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libs/libc') diff --git a/libs/libc/list.c b/libs/libc/list.c index bda9e20..3f37478 100644 --- a/libs/libc/list.c +++ b/libs/libc/list.c @@ -110,7 +110,6 @@ struct node *list_add(struct list *list, void *data) } // Maybe list_remove_node? -// TODO: Free node on destroy struct list *list_remove(struct list *list, struct node *node) { if (!list->head) @@ -118,6 +117,7 @@ struct list *list_remove(struct list *list, struct node *node) if (list->head == node) { list->head = list->head->next; + free(node); return list; } @@ -131,5 +131,6 @@ struct list *list_remove(struct list *list, struct node *node) iterator->prev->next = iterator->next; if (iterator->next) iterator->next->prev = iterator->prev; + free(node); return list; } -- cgit v1.2.3