代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/third_party_libxml2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From f442a3290626a522b6e71c902a971859b15566f3 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 30 Oct 2022 12:32:14 +0100
Subject: [PATCH 02/28] xinclude: Fix more memory leaks in xmlXIncludeLoadDoc
Reference: https://github.com/GNOME/libxml2/commit/f14529baf5315b3d77877fd1617b0e1f3df564d0
Conflict: xinclude.c:<xmlXIncludeLoadDoc>
---
xinclude.c | 37 ++++++++++++++-----------------------
1 file changed, 14 insertions(+), 23 deletions(-)
diff --git a/xinclude.c b/xinclude.c
index 6ee58cb..cd1e1b1 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -1417,9 +1417,10 @@ static int
xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlDocPtr doc;
xmlURIPtr uri;
- xmlChar *URL;
+ xmlChar *URL = NULL;
xmlChar *fragment = NULL;
int i = 0;
+ int ret = -1;
#ifdef LIBXML_XPTR_ENABLED
int saveFlags;
#endif
@@ -1435,7 +1436,7 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
XML_XINCLUDE_HREF_URI,
"invalid value URI %s\n", url);
- return(-1);
+ goto error;
}
if (uri->fragment != NULL) {
fragment = (xmlChar *) uri->fragment;
@@ -1457,9 +1458,7 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlXIncludeErr(ctxt, NULL,
XML_XINCLUDE_HREF_URI,
"invalid value URI %s\n", url);
- if (fragment != NULL)
- xmlFree(fragment);
- return(-1);
+ goto error;
}
/*
@@ -1509,10 +1508,7 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
ctxt->parseFlags = saveFlags;
#endif
if (doc == NULL) {
- xmlFree(URL);
- if (fragment != NULL)
- xmlFree(fragment);
- return(-1);
+ goto error;
}
ctxt->incTab[nr]->doc = doc;
/*
@@ -1578,9 +1574,7 @@ loaded:
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
XML_XINCLUDE_XPTR_FAILED,
"could not create XPointer context\n", NULL);
- xmlFree(URL);
- xmlFree(fragment);
- return(-1);
+ goto error;
}
xptr = xmlXPtrEval(fragment, xptrctxt);
if (xptr == NULL) {
@@ -1589,9 +1583,7 @@ loaded:
"XPointer evaluation failed: #%s\n",
fragment);
xmlXPathFreeContext(xptrctxt);
- xmlFree(URL);
- xmlFree(fragment);
- return(-1);
+ goto error;
}
switch (xptr->type) {
case XPATH_UNDEFINED:
@@ -1607,17 +1599,13 @@ loaded:
fragment);
xmlXPathFreeObject(xptr);
xmlXPathFreeContext(xptrctxt);
- xmlFree(URL);
- xmlFree(fragment);
- return(-1);
+ goto error;
case XPATH_NODESET:
if ((xptr->nodesetval == NULL) ||
(xptr->nodesetval->nodeNr <= 0)) {
xmlXPathFreeObject(xptr);
xmlXPathFreeContext(xptrctxt);
- xmlFree(URL);
- xmlFree(fragment);
- return(-1);
+ goto error;
}
case XPATH_RANGE:
@@ -1681,7 +1669,6 @@ loaded:
xmlXIncludeCopyXPointer(ctxt, ctxt->doc, doc, xptr);
xmlXPathFreeObject(xptr);
xmlXPathFreeContext(xptrctxt);
- xmlFree(fragment);
}
#endif
@@ -1777,8 +1764,12 @@ loaded:
xmlFreeDoc(ctxt->incTab[nr]->doc);
ctxt->incTab[nr]->doc = NULL;
}
+ ret = 0;
+
+error:
xmlFree(URL);
- return(0);
+ xmlFree(fragment);
+ return(ret);
}
/**
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。