Index: third_party/libxslt/libxslt/functions.c |
=================================================================== |
--- third_party/libxslt/libxslt/functions.c (revision 148983) |
+++ third_party/libxslt/libxslt/functions.c (working copy) |
@@ -654,6 +654,7 @@ |
void |
xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ |
xmlNodePtr cur = NULL; |
+ xmlXPathObjectPtr obj = NULL; |
long val; |
xmlChar str[30]; |
xmlDocPtr doc; |
@@ -661,7 +662,6 @@ |
if (nargs == 0) { |
cur = ctxt->context->node; |
} else if (nargs == 1) { |
- xmlXPathObjectPtr obj; |
xmlNodeSetPtr nodelist; |
int i, ret; |
@@ -684,7 +684,6 @@ |
if (ret == -1) |
cur = nodelist->nodeTab[i]; |
} |
- xmlXPathFreeObject(obj); |
} else { |
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
"generate-id() : invalid number of args %d\n", nargs); |
@@ -707,6 +706,9 @@ |
} |
+ if (obj) |
+ xmlXPathFreeObject(obj); |
+ |
val = (long)((char *)cur - (char *)doc); |
if (val >= 0) { |
sprintf((char *)str, "idp%ld", val); |