mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-08 21:42:07 +03:00
exslt: Fix EXSLT functions without parameters
Fix regression from commit 7364666b
on platforms where malloc(0) returns
NULL.
Should fix #100.
This commit is contained in:
@@ -385,6 +385,7 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
newBase = tctxt->varsNr;
|
newBase = tctxt->varsNr;
|
||||||
/* If there are any parameters */
|
/* If there are any parameters */
|
||||||
if (paramNode != NULL) {
|
if (paramNode != NULL) {
|
||||||
|
if (nargs > 0) {
|
||||||
args = (xmlXPathObjectPtr *) xmlMalloc(sizeof(*args) * nargs);
|
args = (xmlXPathObjectPtr *) xmlMalloc(sizeof(*args) * nargs);
|
||||||
if (args == NULL)
|
if (args == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -392,6 +393,7 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
for (i = nargs - 1; i >= 0; i--) {
|
for (i = nargs - 1; i >= 0; i--) {
|
||||||
args[i] = valuePop(ctxt);
|
args[i] = valuePop(ctxt);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prepare to process params in reverse order. First, go to
|
* Prepare to process params in reverse order. First, go to
|
||||||
|
Reference in New Issue
Block a user