From 66125fe35345aaf6255a30a42d501383bcbe1bb3 Mon Sep 17 00:00:00 2001 From: Martin <gzlist@googlemail.com> Date: Thu, 17 Sep 2009 09:59:42 +0200 Subject: [PATCH] QName parsing fix for patterns To: libvir-list@redhat.com * libxslt/pattern.c: fix a corner case and avoid a memory leak on error Signed-off-by: Daniel Veillard <veillard@redhat.com> --- libxslt/pattern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libxslt/pattern.c b/libxslt/pattern.c index ce8d89f..3a639a0 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -1347,7 +1347,7 @@ xsltScanQName(xsltParserContextPtr ctxt, xmlChar **prefix) { *prefix = NULL; ret = xsltScanNCName(ctxt); - if (CUR == ':') { + if (ret && CUR == ':') { *prefix = ret; NEXT; ret = xsltScanNCName(ctxt); @@ -1587,6 +1587,7 @@ parse_node_test: xsltTransformError(NULL, NULL, NULL, "xsltCompileStepPattern : no namespace bound to prefix %s\n", prefix); + xmlFree(prefix); ctxt->error = 1; goto error; } else { -- 1.7.11.4