fixed why2_clean_memory memory leak

wow 'garbage collector' that cases memory leaks

pls don't laugh at me :(
This commit is contained in:
Václav Šmejkal 2023-02-03 16:37:58 +01:00
parent 990476787f
commit cd4c94024a
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -147,12 +147,12 @@ void why2_clean_memory(char *identifier)
while (buffer -> next != NULL) //GO TROUGH LIST while (buffer -> next != NULL) //GO TROUGH LIST
{ {
if (buffer -> identifier == identifier) remove_node(buffer); if (buffer -> identifier == identifier) why2_free(buffer -> pointer);
buffer = buffer -> next; buffer = buffer -> next;
} }
if (buffer -> identifier == identifier) remove_node(buffer); //LAST NODE if (buffer -> identifier == identifier) why2_free(buffer -> pointer); //LAST NODE
why2_reset_memory_identifier(); //THIS WILL CAUSE SEGFAULT IF YOU DIDN'T USE why2_set_memory_identifier why2_reset_memory_identifier(); //THIS WILL CAUSE SEGFAULT IF YOU DIDN'T USE why2_set_memory_identifier
} }