1 Star 0 Fork 44

HuBin95/libxml2

forked from src-openEuler/libxml2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Fix-memleaks-in-xmlXIncludeProcessFlags.patch 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
panxiaohe 提交于 2021-11-05 14:41 . fix memleaks in xmlXIncludeProcessFlags
From b01853fb42257136461d1b45e45ecaa3f3ecd570 Mon Sep 17 00:00:00 2001
From: panxiaohe <panxiaohe@huawei.com>
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hubin95/libxml2.git
git@gitee.com:hubin95/libxml2.git
hubin95
libxml2
libxml2
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385