diff options
-rw-r--r-- | libxslt/functions.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libxslt/functions.c b/libxslt/functions.c index a1484a07..283ff24b 100644 --- a/libxslt/functions.c +++ b/libxslt/functions.c @@ -383,6 +383,12 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ xmlXPathObjectPtr newobj, ret; ret = xmlXPathNewNodeSet(NULL); + if (ret == NULL) { + ctxt->error = XPATH_MEMORY_ERROR; + xmlXPathFreeObject(obj1); + xmlXPathFreeObject(obj2); + return; + } if (obj2->nodesetval != NULL) { for (i = 0; i < obj2->nodesetval->nodeNr; i++) { |