mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-12 23:05:31 +00:00
Fix memory leak for mxmlDelete (Issue #183)
This commit is contained in:
parent
8c6a46e4f6
commit
1272c3dfdb
24
mxml-node.c
24
mxml-node.c
@ -219,29 +219,23 @@ mxmlDelete(mxml_node_t *node) /* I - Node to delete */
|
||||
|
||||
if ((next = current->next) == NULL)
|
||||
{
|
||||
mxml_node_t *temp = current->parent;
|
||||
/* Pointer to parent node */
|
||||
|
||||
if (temp == node)
|
||||
{
|
||||
/*
|
||||
* Got back to the top node...
|
||||
*/
|
||||
/*
|
||||
* Next node is the parent, which we'll free as needed...
|
||||
*/
|
||||
|
||||
if ((next = current->parent) == node)
|
||||
next = NULL;
|
||||
}
|
||||
else if ((next = temp->next) == NULL)
|
||||
{
|
||||
if ((next = temp->parent) == node)
|
||||
next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free child...
|
||||
*/
|
||||
|
||||
mxml_free(current);
|
||||
}
|
||||
|
||||
/*
|
||||
* Then free the memory used by this node...
|
||||
* Then free the memory used by the parent node...
|
||||
*/
|
||||
|
||||
mxml_free(node);
|
||||
|
Loading…
Reference in New Issue
Block a user