From 115a4c20de54662c1fd781859f9896793147b684 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 1 Feb 2023 15:53:58 +0100 Subject: [PATCH] fixed some shitty bugs in remove_node yay now like 4561456456 bugs remain --- src/core/lib/utils/memory.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/lib/utils/memory.c b/src/core/lib/utils/memory.c index 48b9207..71dc4bf 100644 --- a/src/core/lib/utils/memory.c +++ b/src/core/lib/utils/memory.c @@ -68,10 +68,14 @@ void remove_node(node_t *node) //valgrind says this causes memory leaks ('still node -> next -> last = node -> last; } else { - node -> last = NULL; + node -> last -> next = NULL; //idk there could be some bugz } - if (head == NULL) free(head); //LIST IS EMPTY NOW => DEALLOCATE + if (head -> next == NULL) //LIST IS EMPTY NOW => DEALLOCATE + { + free(head); + head = NULL; + } //DEALLOCATION free(node);