components/libxml2/patches/05.mem-leak-fix.patch
changeset 1044 ab6b15638457
parent 1043 585b09419d1c
child 1045 2dbef0a33dc7
equal deleted inserted replaced
1043:585b09419d1c 1044:ab6b15638457
     1 diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py
       
     2 index dcc144c..879de1c 100644
       
     3 --- a/python/tests/xpathleak.py
       
     4 +++ b/python/tests/xpathleak.py
       
     5 @@ -27,7 +27,11 @@ libxml2.registerErrorHandler(callback, "-->")
       
     6  doc = libxml2.parseDoc("<fish/>")
       
     7  ctxt = doc.xpathNewContext()
       
     8  ctxt.setContextNode(doc)
       
     9 -for expr in (":false()","bad:()","bad(:)",":bad(:)","bad:(:)","bad:bad(:)"):
       
    10 +badexprs = (
       
    11 +	":false()", "bad:()", "bad(:)", ":bad(:)", "bad:(:)", "bad:bad(:)",
       
    12 +	"a:/b", "/c:/d", "//e:/f", "g://h"
       
    13 +	)
       
    14 +for expr in badexprs:
       
    15  	try:
       
    16  		ctxt.xpathEval(expr)
       
    17  	except libxml2.xpathError, e:
       
    18 diff --git a/xpath.c b/xpath.c
       
    19 index 5b84d22..8482c40 100644
       
    20 --- a/xpath.c
       
    21 +++ b/xpath.c
       
    22 @@ -11333,6 +11333,7 @@ xmlXPathCompRelativeLocationPath
       
    23  	SKIP_BLANKS;
       
    24      }
       
    25      xmlXPathCompStep(ctxt);
       
    26 +    CHECK_ERROR;
       
    27      SKIP_BLANKS;
       
    28      while (CUR == '/') {
       
    29  	if ((CUR == '/') && (NXT(1) == '/')) {
       
    30 @@ -11392,6 +11393,7 @@ xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) {
       
    31  		     (CUR == '@') || (CUR == '*')))
       
    32  		    xmlXPathCompRelativeLocationPath(ctxt);
       
    33  	    }
       
    34 +	    CHECK_ERROR;
       
    35  	}
       
    36      }
       
    37  }
       
    38