From 9c39297291ae8c370d2fcaf55993b9e215c23190 Mon Sep 17 00:00:00 2001 From: panxiaohe Date: Tue, 2 Nov 2021 18:59:47 +0800 Subject: [PATCH] fix memleaks in xmlXIncludeProcessFlags --- Fix-memleaks-in-xmlXIncludeProcessFlags.patch | 41 +++++++++++++++++++ libxml2.spec | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 Fix-memleaks-in-xmlXIncludeProcessFlags.patch diff --git a/Fix-memleaks-in-xmlXIncludeProcessFlags.patch b/Fix-memleaks-in-xmlXIncludeProcessFlags.patch new file mode 100644 index 0000000..40a76fe --- /dev/null +++ b/Fix-memleaks-in-xmlXIncludeProcessFlags.patch @@ -0,0 +1,41 @@ +From b01853fb42257136461d1b45e45ecaa3f3ecd570 Mon Sep 17 00:00:00 2001 +From: panxiaohe +Date: Tue, 9 Nov 2021 14:27:24 +0800 +Subject: [PATCH] Fix memleaks in xmlXIncludeProcessFlags + +--- + tree.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/tree.c b/tree.c +index 17e59d7..64799fb 100644 +--- a/tree.c ++++ b/tree.c +@@ -3720,11 +3720,19 @@ xmlFreeNodeList(xmlNodePtr cur) { + * Otherwise the node name might come from the document's + * dictionary + */ +- if ((cur->name != NULL) && +- (cur->type != XML_TEXT_NODE) && +- (cur->type != XML_COMMENT_NODE)) +- DICT_FREE(cur->name) +- xmlFree(cur); ++ if ((cur->type == XML_DOCUMENT_NODE) || ++#ifdef LIBXML_DOCB_ENABLED ++ (cur->type == XML_DOCB_DOCUMENT_NODE) || ++#endif ++ (cur->type == XML_HTML_DOCUMENT_NODE)) { ++ xmlFreeDoc((xmlDocPtr) cur); ++ } else { ++ if ((cur->name != NULL) && ++ (cur->type != XML_TEXT_NODE) && ++ (cur->type != XML_COMMENT_NODE)) ++ DICT_FREE(cur->name) ++ xmlFree(cur); ++ } + } + + if (next != NULL) { +-- +1.8.3.1 + diff --git a/libxml2.spec b/libxml2.spec index 95389a7..bcf7b08 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,7 +1,7 @@ Summary: Library providing XML and HTML support Name: libxml2 Version: 2.9.10 -Release: 19 +Release: 20 License: MIT Group: Development/Libraries Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz @@ -101,6 +101,7 @@ Patch88: Stop-using-maxParserDepth-in-xpath.c.patch Patch89: Hardcode-maximum-XPath-recursion-depth.patch Patch90: Fix-XPath-recursion-limit.patch Patch91: Fix-Null-deref-in-xmlSchemaGetComponentTargetNs.patch +Patch92: Fix-memleaks-in-xmlXIncludeProcessFlags.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: python2-devel @@ -293,6 +294,12 @@ rm -fr %{buildroot} %changelog +* Tue Nov 9 2021 panxiaohe - 2.9.10-20 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix memleaks in xmlXIncludeProcessFlags + * Sat Oct 30 2021 huangduirong - 2.9.10-19 - Type:bugfix - ID:NA -- Gitee