1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-13 13:17:36 +03:00

xpath: Report malloc failure in xmlXPathTranslateFunction

This commit is contained in:
Nick Wellnhofer 2024-02-05 15:35:54 +01:00
parent 1a66b17605
commit 2963a097b9

View File

@ -8305,7 +8305,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
int offset, max;
int ch;
const xmlChar *point;
xmlChar *cptr;
xmlChar *cptr, *content;
CHECK_ARITY(3);
@ -8355,7 +8355,11 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
}
}
valuePush(ctxt, xmlXPathCacheNewString(ctxt, xmlBufContent(target)));
content = xmlBufDetach(target);
if (content == NULL)
xmlXPathPErrMemory(ctxt);
else
valuePush(ctxt, xmlXPathCacheWrapString(ctxt, content));
xmlBufFree(target);
error:
xmlXPathReleaseObject(ctxt->context, str);