From 6844b3d218e389413c7acbf77691205c6754afb2 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 5 Feb 2023 18:54:11 +0100 Subject: [PATCH] moved NULL check to top of why2_deallocate --- src/core/lib/utils/memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/lib/utils/memory.c b/src/core/lib/utils/memory.c index 14c1cc0..e826e53 100644 --- a/src/core/lib/utils/memory.c +++ b/src/core/lib/utils/memory.c @@ -165,6 +165,8 @@ void why2_deallocate(void *pointer) //VARIABLES node_t *node = get_node(pointer); + if (node == NULL) return; + switch (node -> type) //DEALLOCATE BY THE CORRECT WAY { case ALLOCATION: //STANDARD MALLOC, CALLOC OR REALLOC @@ -184,7 +186,7 @@ void why2_deallocate(void *pointer) break; } - if (node != NULL) remove_node(node); //REMOVE FROM LIST IF FOUND + remove_node(node); //REMOVE FROM LIST IF FOUND } void why2_clean_memory(char *identifier)