Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: third_party/libxslt/libxslt/functions.c

Issue 1848793005: Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libxslt/libxslt/extensions.c ('k') | third_party/libxslt/libxslt/imports.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/libxslt/functions.c
diff --git a/third_party/libxslt/libxslt/functions.c b/third_party/libxslt/libxslt/functions.c
index dc61994572efee65f65cf1ec85d5d71a4022df5a..a5e7021010f8aa48c8da410da16f13bdd9aa8566 100644
--- a/third_party/libxslt/libxslt/functions.c
+++ b/third_party/libxslt/libxslt/functions.c
@@ -180,7 +180,6 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
resObj = xmlXPtrEval(fragment, xptrctxt);
xmlXPathFreeContext(xptrctxt);
#endif
- xmlFree(fragment);
if (resObj == NULL)
goto out_fragment;
@@ -204,6 +203,7 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
}
valuePush(ctxt, resObj);
+ xmlFree(fragment);
return;
out_object:
@@ -211,6 +211,7 @@ out_object:
out_fragment:
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+ xmlFree(fragment);
}
/**
@@ -665,7 +666,6 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
xmlXPathObjectPtr obj = NULL;
long val;
xmlChar str[30];
- xmlDocPtr doc;
if (nargs == 0) {
cur = ctxt->context->node;
@@ -698,30 +698,15 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
ctxt->error = XPATH_INVALID_ARITY;
return;
}
- /*
- * Okay this is ugly but should work, use the NodePtr address
- * to forge the ID
- */
- if (cur->type != XML_NAMESPACE_DECL)
- doc = cur->doc;
- else {
- xmlNsPtr ns = (xmlNsPtr) cur;
-
- if (ns->context != NULL)
- doc = ns->context;
- else
- doc = ctxt->context->doc;
-
- }
if (obj)
xmlXPathFreeObject(obj);
val = (long)((char *)cur - (char *)&base_address);
if (val >= 0) {
- sprintf((char *)str, "idp%ld", val);
+ snprintf((char *)str, sizeof(str), "idp%ld", val);
} else {
- sprintf((char *)str, "idm%ld", -val);
+ snprintf((char *)str, sizeof(str), "idm%ld", -val);
}
valuePush(ctxt, xmlXPathNewString(str));
}
« no previous file with comments | « third_party/libxslt/libxslt/extensions.c ('k') | third_party/libxslt/libxslt/imports.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698