mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-13 23:35:30 +00:00
Fix memory leak for mxmlDelete (Issue #183)
This commit is contained in:
parent
8c6a46e4f6
commit
1272c3dfdb
20
mxml-node.c
20
mxml-node.c
@ -218,30 +218,24 @@ 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