components/libxml2/patches/05.mem-leak-fix.patch
author Tomas Kuthan <tomas.kuthan@oracle.com>
Mon, 11 Jun 2012 22:35:26 -0700
changeset 866 c6e2467e422e
parent 284 ca417a821aee
permissions -rw-r--r--
7155371 "ldm init-system" on s11u1 hits libcrypto.so.1.0.0`pk11_get_session SEGV in mutex_lock_impl 6980830 Memory leaked when calling ENGINE_load_private_key()

diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py
index dcc144c..879de1c 100644
--- a/python/tests/xpathleak.py
+++ b/python/tests/xpathleak.py
@@ -27,7 +27,11 @@ libxml2.registerErrorHandler(callback, "-->")
 doc = libxml2.parseDoc("<fish/>")
 ctxt = doc.xpathNewContext()
 ctxt.setContextNode(doc)
-for expr in (":false()","bad:()","bad(:)",":bad(:)","bad:(:)","bad:bad(:)"):
+badexprs = (
+	":false()", "bad:()", "bad(:)", ":bad(:)", "bad:(:)", "bad:bad(:)",
+	"a:/b", "/c:/d", "//e:/f", "g://h"
+	)
+for expr in badexprs:
 	try:
 		ctxt.xpathEval(expr)
 	except libxml2.xpathError, e:
diff --git a/xpath.c b/xpath.c
index 5b84d22..8482c40 100644
--- a/xpath.c
+++ b/xpath.c
@@ -11333,6 +11333,7 @@ xmlXPathCompRelativeLocationPath
 	SKIP_BLANKS;
     }
     xmlXPathCompStep(ctxt);
+    CHECK_ERROR;
     SKIP_BLANKS;
     while (CUR == '/') {
 	if ((CUR == '/') && (NXT(1) == '/')) {
@@ -11392,6 +11393,7 @@ xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) {
 		     (CUR == '@') || (CUR == '*')))
 		    xmlXPathCompRelativeLocationPath(ctxt);
 	    }
+	    CHECK_ERROR;
 	}
     }
 }