[libxml2] Fix memory leak with XPath namespace nodes
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix memory leak with XPath namespace nodes
- Date: Thu, 5 May 2016 15:39:49 +0000 (UTC)
commit 6eb0894a96d4d8122e5129e02f78a2b449cc2580
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu May 5 16:49:00 2016 +0200
Fix memory leak with XPath namespace nodes
Set hasNsNodes to 1 when adding namespace nodes via XP_TEST_HIT.
result/XPath/tests/nssimple | 8 ++++++++
test/XPath/tests/nssimple | 1 +
xpath.c | 1 +
3 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/result/XPath/tests/nssimple b/result/XPath/tests/nssimple
index 1f3b2ce..8f0dd0e 100644
--- a/result/XPath/tests/nssimple
+++ b/result/XPath/tests/nssimple
@@ -7,6 +7,14 @@ Set contains 1 nodes:
namespace ns2 href=nsuri2
========================
+Expression: /doc/elem/namespace::*/self::node()[true()]
+Object is a Node Set :
+Set contains 3 nodes:
+1 namespace xml href=http://www.w3.org/XML/1998/namespace
+2 namespace ns1 href=nsuri1
+3 namespace ns2 href=nsuri2
+
+========================
Expression: //*[namespace::ns1]
Object is a Node Set :
Set contains 2 nodes:
diff --git a/test/XPath/tests/nssimple b/test/XPath/tests/nssimple
index 2b25587..d2a9528 100644
--- a/test/XPath/tests/nssimple
+++ b/test/XPath/tests/nssimple
@@ -1,2 +1,3 @@
/doc/elem/namespace::node()/..
+/doc/elem/namespace::*/self::node()[true()]
//*[namespace::ns1]
diff --git a/xpath.c b/xpath.c
index 64dcc5c..620e814 100644
--- a/xpath.c
+++ b/xpath.c
@@ -12398,6 +12398,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
if (axis == AXIS_NAMESPACE) {
XP_TEST_HIT_NS
} else {
+ hasNsNodes = 1;
XP_TEST_HIT
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]