1From b01853fb42257136461d1b45e45ecaa3f3ecd570 Mon Sep 17 00:00:00 2001 2From: panxiaohe <panxiaohe@huawei.com> 3Date: Tue, 9 Nov 2021 14:27:24 +0800 4Subject: [PATCH] Fix memleaks in xmlXIncludeProcessFlags 5 6--- 7 tree.c | 18 +++++++++++++----- 8 1 file changed, 13 insertions(+), 5 deletions(-) 9 10diff --git a/tree.c b/tree.c 11index 17e59d7..64799fb 100644 12--- a/tree.c 13+++ b/tree.c 14@@ -3720,11 +3720,19 @@ xmlFreeNodeList(xmlNodePtr cur) { 15 * Otherwise the node name might come from the document's 16 * dictionary 17 */ 18- if ((cur->name != NULL) && 19- (cur->type != XML_TEXT_NODE) && 20- (cur->type != XML_COMMENT_NODE)) 21- DICT_FREE(cur->name) 22- xmlFree(cur); 23+ if ((cur->type == XML_DOCUMENT_NODE) || 24+#ifdef LIBXML_DOCB_ENABLED 25+ (cur->type == XML_DOCB_DOCUMENT_NODE) || 26+#endif 27+ (cur->type == XML_HTML_DOCUMENT_NODE)) { 28+ xmlFreeDoc((xmlDocPtr) cur); 29+ } else { 30+ if ((cur->name != NULL) && 31+ (cur->type != XML_TEXT_NODE) && 32+ (cur->type != XML_COMMENT_NODE)) 33+ DICT_FREE(cur->name) 34+ xmlFree(cur); 35+ } 36 } 37 38 if (next != NULL) { 39-- 401.8.3.1 41 42