added 'bypass' to why2_clean_memory
if you pass DEFAULT_IDENTIFIER as parameter every node is deallocated
This commit is contained in:
parent
cd4c94024a
commit
f4975050e4
@ -144,15 +144,16 @@ void why2_clean_memory(char *identifier)
|
|||||||
if (head == NULL) return; //LIST IS EMPTY
|
if (head == NULL) return; //LIST IS EMPTY
|
||||||
|
|
||||||
node_t *buffer = head;
|
node_t *buffer = head;
|
||||||
|
why2_bool force_deallocating = identifier == why2_get_default_memory_identifier();
|
||||||
|
|
||||||
while (buffer -> next != NULL) //GO TROUGH LIST
|
while (buffer -> next != NULL) //GO TROUGH LIST
|
||||||
{
|
{
|
||||||
if (buffer -> identifier == identifier) why2_free(buffer -> pointer);
|
if (buffer -> identifier == identifier || force_deallocating) why2_free(buffer -> pointer);
|
||||||
|
|
||||||
buffer = buffer -> next;
|
buffer = buffer -> next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer -> identifier == identifier) why2_free(buffer -> pointer); //LAST NODE
|
if (buffer -> identifier == identifier || force_deallocating) 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
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user