diff options
author | Martin <gzlist@googlemail.com> | 2009-10-12 22:42:26 +0200 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2009-10-12 22:42:26 +0200 |
commit | 729601f15772c19778062b98bd0716d8f5c2af3b (patch) | |
tree | 5ede0ea9c83a2a72fc08132e6003cdeaaade1c7b /python/tests | |
parent | 2c2128387d7b5670f7f4a54cedc45b3b29552630 (diff) | |
download | libxml2-729601f15772c19778062b98bd0716d8f5c2af3b.tar.gz |
Fix memory leak in xmlXPathEvalExpression()
* xpath.c: plug some leaks when parsing misformed XPath expressions
* python/tests/xpathleak.py: expand the regression tests for those
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/xpathleak.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py index dcc144c1..39f49e32 100644 --- a/python/tests/xpathleak.py +++ b/python/tests/xpathleak.py @@ -15,6 +15,14 @@ expect="""--> Invalid expression --> xmlXPathEval: evaluation failed --> Invalid expression --> xmlXPathEval: evaluation failed +--> Invalid expression +--> xmlXPathEval: evaluation failed +--> Invalid expression +--> xmlXPathEval: evaluation failed +--> Invalid expression +--> xmlXPathEval: evaluation failed +--> Invalid expression +--> xmlXPathEval: evaluation failed """ err="" def callback(ctx, str): @@ -27,7 +35,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: |