diff --git a/src/core/lib/utils/memory.c b/src/core/lib/utils/memory.c index 2aa0b79..8f8a728 100644 --- a/src/core/lib/utils/memory.c +++ b/src/core/lib/utils/memory.c @@ -66,15 +66,16 @@ void remove_node(node_t *node) //valgrind says this causes memory leaks ('still if (node -> next != NULL) { node -> next -> last = node -> last; - } else if (node -> last != NULL) + } else { - node -> last -> next = NULL; - } - - if (head -> next == NULL) //LIST IS EMPTY NOW => DEALLOCATE - { - free(head); - head = NULL; + if (node -> last != NULL) + { + node -> last -> next = NULL; + } else //LIST IS EMPTY NOW => DEALLOCATE + { + free(head); + head = NULL; + } } //DEALLOCATION