call xmlFreeNode() or xmlFreeDoc() depending on the type of node, to be safe

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34734 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2012-02-07 18:41:28 +00:00
parent da87b87a52
commit 816017aec4
2 changed files with 12 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2012-02-07 Doug Simons <doug.simons@testplant.com>
* Source/NSXMLNode.m: Changed dealloc to call xmlFreeNode() or
xmlFreeDoc() depending on the type of node.
2012-02-07 13:12-EST Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSXMLNode.m: Correct issue with crash on

View file

@ -952,7 +952,14 @@ NSLog(@"RELEASING TRICKY EXTRA RETAIN in %@ now: %d", self, internal->externalRe
node->_private = NULL;
if (node && node->parent == NULL)
{
<<<<<<< .mine
if (node->type == XML_DOCUMENT_NODE)
xmlFreeDoc((xmlDocPtr)node);
else
xmlFreeNode(node); // the top level node frees the entire tree
=======
xmlFreeNode(node); // the top level node frees the entire tree
>>>>>>> .r34733
}
GS_DESTROY_INTERNAL(NSXMLNode);
}