Index: third_party/libxslt/libxslt/functions.c |
diff --git a/third_party/libxslt/libxslt/functions.c b/third_party/libxslt/libxslt/functions.c |
index a5e7021010f8aa48c8da410da16f13bdd9aa8566..ec22203f4ca21f7ac5ac13da4b39695e22466fa0 100644 |
--- a/third_party/libxslt/libxslt/functions.c |
+++ b/third_party/libxslt/libxslt/functions.c |
@@ -835,7 +835,7 @@ xsltElementAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ |
} |
obj = valuePop(ctxt); |
tctxt = xsltXPathGetTransformContext(ctxt); |
- if (tctxt == NULL) { |
+ if ((tctxt == NULL) || (tctxt->inst == NULL)) { |
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
"element-available() : internal error tctxt == NULL\n"); |
xmlXPathFreeObject(obj); |
@@ -850,7 +850,7 @@ xsltElementAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ |
name = xmlStrdup(obj->stringval); |
ns = xmlSearchNs(tctxt->inst->doc, tctxt->inst, NULL); |
- if (ns != NULL) nsURI = xmlStrdup(ns->href); |
+ if (ns != NULL) nsURI = ns->href; |
} else { |
nsURI = xmlXPathNsLookup(ctxt->context, prefix); |
if (nsURI == NULL) { |