diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2018-09-22 15:41:01 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2018-09-22 15:41:01 +0200 |
commit | 0ed6addb8f165ae533fbe812e4a973c7b682ec7e (patch) | |
tree | a9435821a8762f3cf0708a760563bfcbaff6dafa | |
parent | 8c9daf790abfc06e8ca3a44652542c577bb67d49 (diff) | |
download | libxml2-0ed6addb8f165ae533fbe812e4a973c7b682ec7e.tar.gz |
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.
-rw-r--r-- | SAX2.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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; } |