summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2016-05-05 16:49:00 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2016-05-05 17:38:27 +0200
commit6eb0894a96d4d8122e5129e02f78a2b449cc2580 (patch)
tree653dd30625cd190894304d6fc00a4b1a7ef0fbaa
parent82b73039dc0eed620621cb699b1140c6e0c89cce (diff)
downloadlibxml2-6eb0894a96d4d8122e5129e02f78a2b449cc2580.tar.gz
Fix memory leak with XPath namespace nodes
Set hasNsNodes to 1 when adding namespace nodes via XP_TEST_HIT.
-rw-r--r--result/XPath/tests/nssimple8
-rw-r--r--test/XPath/tests/nssimple1
-rw-r--r--xpath.c1
3 files changed, 10 insertions, 0 deletions
diff --git a/result/XPath/tests/nssimple b/result/XPath/tests/nssimple
index 1f3b2ceb..8f0dd0e3 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 2b25587d..d2a95281 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 64dcc5c1..620e8144 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;