summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2019-12-06 12:27:29 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2019-12-06 12:27:29 +0100
commit0815302dee2b78139832c2080348086a0564836b (patch)
treee27714c0ecf66a4eb2b3af21ce40187cb2dc0a95 /tree.c
parent2c80fc911678adc9dcf252b3bc71cce101c8728e (diff)
downloadlibxml2-0815302dee2b78139832c2080348086a0564836b.tar.gz
Fix freeing of nested documents
Apparently, some libxslt RVTs can contain nested document nodes, see issue #132. I'm not sure how this happens exactly but it can cause a segfault in xmlFreeNodeList after the changes in commit 0762c9b6. Make sure not to touch the (nonexistent) `content` member of xmlDocs.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tree.c b/tree.c
index 070670f1..0d7fc98c 100644
--- a/tree.c
+++ b/tree.c
@@ -3708,6 +3708,11 @@ xmlFreeNodeList(xmlNodePtr cur) {
(cur->type != XML_XINCLUDE_START) &&
(cur->type != XML_XINCLUDE_END) &&
(cur->type != XML_ENTITY_REF_NODE) &&
+ (cur->type != XML_DOCUMENT_NODE) &&
+#ifdef LIBXML_DOCB_ENABLED
+ (cur->type != XML_DOCB_DOCUMENT_NODE) &&
+#endif
+ (cur->type != XML_HTML_DOCUMENT_NODE) &&
(cur->content != (xmlChar *) &(cur->properties))) {
DICT_FREE(cur->content)
}