From 395f78707a2bb37e5f2660a80d49bf41c8d22d85 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 5 Feb 2023 18:43:10 +0100 Subject: [PATCH] moved remove_node at the bottom of why2_deallocate cuz fokin memory leak memery lek --- src/core/lib/utils/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/utils/memory.c b/src/core/lib/utils/memory.c index 989b0b0..80f02a4 100644 --- a/src/core/lib/utils/memory.c +++ b/src/core/lib/utils/memory.c @@ -156,8 +156,6 @@ void why2_deallocate(void *pointer) //VARIABLES node_t *node = get_node(pointer); - if (node != NULL) remove_node(node); //REMOVE FROM LIST IF FOUND - switch (node -> type) //DEALLOCATE BY THE CORRECT WAY { case ALLOCATION: //STANDARD MALLOC, CALLOC OR REALLOC @@ -176,6 +174,8 @@ void why2_deallocate(void *pointer) closedir(pointer); break; } + + if (node != NULL) remove_node(node); //REMOVE FROM LIST IF FOUND } void why2_clean_memory(char *identifier)