From 85731bab389876bc4f3b6f6ed008600ce07d324b Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 1 Feb 2023 15:26:17 +0100 Subject: [PATCH] added check if pointer was found in why2_free --- src/core/lib/utils/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/utils/memory.c b/src/core/lib/utils/memory.c index 7cca62e..48b9207 100644 --- a/src/core/lib/utils/memory.c +++ b/src/core/lib/utils/memory.c @@ -127,6 +127,6 @@ void why2_free(void *pointer) node_buffer = node_buffer -> next; } - remove_node(node_buffer); //REMOVE FROM LIST | IF ISN'T FOUND, PROBABLY WILL CAUSE SEGFAULT (I WON'T MAKE IT SAFE; FUCK YOU - USE why2_free ONLY IF YOU ALLOCATED WITH why2_foo) + if (pointer == node_buffer -> pointer) remove_node(node_buffer); //REMOVE FROM LIST IF FOUND free(pointer); } \ No newline at end of file