reformated why2_free
I just realized I am freeing with why2_free ALL THE TIME, so it is causing some problems when freeing like strdup or anything
This commit is contained in:
parent
c8e2c4226d
commit
66560fd033
@ -113,12 +113,13 @@ void why2_free(void *pointer)
|
||||
node_t *node_buffer = head;
|
||||
|
||||
//FIND pointer IN LINKED LIST
|
||||
while (node_buffer -> next != NULL) //if pointer won't be found, nothing will happen | idk if I wanna fix this or leave it like this
|
||||
while (node_buffer -> next != NULL)
|
||||
{
|
||||
node_buffer = node_buffer -> next;
|
||||
if (node_buffer -> pointer == pointer) break; //FOUND
|
||||
|
||||
node_buffer = node_buffer -> next;
|
||||
}
|
||||
|
||||
remove_node(node_buffer);
|
||||
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)
|
||||
free(pointer);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user