mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Unlink node before freeing it in xmlSAX2StartElement
The node may have been added to the document already, so it must be unlinked first. Thanks to David Kilzer for spotting this.
This commit is contained in:
2
SAX2.c
2
SAX2.c
@@ -1666,6 +1666,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
|
||||
xmlGenericError(xmlGenericErrorContext, "pushing(%s)\n", name);
|
||||
#endif
|
||||
if (nodePush(ctxt, ret) < 0) {
|
||||
xmlUnlinkNode(ret);
|
||||
xmlFreeNode(ret);
|
||||
return;
|
||||
}
|
||||
@@ -2340,6 +2341,7 @@ xmlSAX2StartElementNs(void *ctx,
|
||||
* We are parsing a new node.
|
||||
*/
|
||||
if (nodePush(ctxt, ret) < 0) {
|
||||
xmlUnlinkNode(ret);
|
||||
xmlFreeNode(ret);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user