fixed possible get_node issue
This commit is contained in:
parent
568ac4e43e
commit
17cc602629
@ -83,6 +83,8 @@ node_t *get_node(void *pointer)
|
|||||||
buffer = buffer -> next;
|
buffer = buffer -> next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pointer != buffer -> pointer) buffer = NULL; //PREVENT FROM RETURNING INVALID NODE
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +130,10 @@ void why2_free(void *pointer)
|
|||||||
//VARIABLES
|
//VARIABLES
|
||||||
node_t *node = get_node(pointer);
|
node_t *node = get_node(pointer);
|
||||||
|
|
||||||
if (pointer == node)
|
if (pointer != NULL)
|
||||||
{
|
{
|
||||||
remove_node(node); //REMOVE FROM LIST IF FOUND
|
remove_node(node); //REMOVE FROM LIST IF FOUND
|
||||||
} //TODO: ELSE happens really often
|
}
|
||||||
|
|
||||||
free(pointer);
|
free(pointer);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user