Fix memory leak for mxmlDelete (Issue #183)

This commit is contained in:
Michael Sweet 2017-03-29 18:18:22 -04:00
parent 8c6a46e4f6
commit 1272c3dfdb

View File

@ -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);