1 From 0815302dee2b78139832c2080348086a0564836b Mon Sep 17 00:00:00 2001
2 From: Nick Wellnhofer <wellnhofer@aevum.de>
3 Date: Fri, 6 Dec 2019 12:27:29 +0100
4 Subject: [PATCH] Fix freeing of nested documents
6 Apparently, some libxslt RVTs can contain nested document nodes, see
7 issue #132. I'm not sure how this happens exactly but it can cause a
8 segfault in xmlFreeNodeList after the changes in commit 0762c9b6.
10 Make sure not to touch the (nonexistent) `content` member of xmlDocs.
13 1 file changed, 5 insertions(+)
15 diff --git a/tree.c b/tree.c
16 index 070670f1..0d7fc98c 100644
19 @@ -3708,6 +3708,11 @@ xmlFreeNodeList(xmlNodePtr cur) {
20 (cur->type != XML_XINCLUDE_START) &&
21 (cur->type != XML_XINCLUDE_END) &&
22 (cur->type != XML_ENTITY_REF_NODE) &&
23 + (cur->type != XML_DOCUMENT_NODE) &&
24 +#ifdef LIBXML_DOCB_ENABLED
25 + (cur->type != XML_DOCB_DOCUMENT_NODE) &&
27 + (cur->type != XML_HTML_DOCUMENT_NODE) &&
28 (cur->content != (xmlChar *) &(cur->properties))) {
29 DICT_FREE(cur->content)