mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-08 21:42:07 +03:00
fixed memory leaks
* libexslt/functions.c: fixed memory leaks
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
Lun Jul 30 05:47:43 CEST 2001 Thomas Broyer <tbroyer@ltgt.net>
|
||||||
|
|
||||||
|
* libexslt/functions.c: fixed memory leaks
|
||||||
|
|
||||||
Sun Jul 29 08:37:59 EDT 2001 Daniel Veillard <daniel@veillard.com>
|
Sun Jul 29 08:37:59 EDT 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* libexslt/functions.c libxslt/extensions.[ch] libxslt/extensions.h
|
* libexslt/functions.c libxslt/extensions.[ch] libxslt/extensions.h
|
||||||
|
@@ -18,15 +18,15 @@
|
|||||||
|
|
||||||
typedef struct _exsltFuncFunctionData exsltFuncFunctionData;
|
typedef struct _exsltFuncFunctionData exsltFuncFunctionData;
|
||||||
struct _exsltFuncFunctionData {
|
struct _exsltFuncFunctionData {
|
||||||
int nargs;
|
int nargs; /* number of arguments to the function */
|
||||||
xmlNodePtr content;
|
xmlNodePtr content; /* the func:fuction template content */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _exsltFuncData exsltFuncData;
|
typedef struct _exsltFuncData exsltFuncData;
|
||||||
struct _exsltFuncData {
|
struct _exsltFuncData {
|
||||||
xmlHashTablePtr funcs;
|
xmlHashTablePtr funcs; /* pointer to the stylesheet module data */
|
||||||
xmlXPathObjectPtr result;
|
xmlXPathObjectPtr result; /* returned by func:result */
|
||||||
int error;
|
int error; /* did an error occur? */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ static void
|
|||||||
exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
|
exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
|
||||||
const xmlChar *URI ATTRIBUTE_UNUSED,
|
const xmlChar *URI ATTRIBUTE_UNUSED,
|
||||||
xmlHashTablePtr data) {
|
xmlHashTablePtr data) {
|
||||||
xmlHashFree(data, NULL);
|
xmlHashFree(data, (xmlHashDeallocator) xmlFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -241,6 +241,8 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
xsltApplyOneTemplate (tctxt, xmlXPathGetContextNode(ctxt),
|
xsltApplyOneTemplate (tctxt, xmlXPathGetContextNode(ctxt),
|
||||||
func->content, NULL, params);
|
func->content, NULL, params);
|
||||||
tctxt->insert = oldInsert;
|
tctxt->insert = oldInsert;
|
||||||
|
if (params != NULL)
|
||||||
|
xsltFreeStackElemList(params);
|
||||||
|
|
||||||
if (data->error != 0)
|
if (data->error != 0)
|
||||||
return;
|
return;
|
||||||
@@ -262,8 +264,10 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
"{%s}%s: cannot write to result tree while "
|
"{%s}%s: cannot write to result tree while "
|
||||||
"executing a function\n",
|
"executing a function\n",
|
||||||
ctxt->context->functionURI, ctxt->context->function);
|
ctxt->context->functionURI, ctxt->context->function);
|
||||||
|
xmlFreeNode(fake);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
xmlFreeNode(fake);
|
||||||
valuePush(ctxt, ret);
|
valuePush(ctxt, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,9 +433,11 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt,
|
|||||||
"func:result content must be empty if it"
|
"func:result content must be empty if it"
|
||||||
" has a select attribute\n");
|
" has a select attribute\n");
|
||||||
data->error = 1;
|
data->error = 1;
|
||||||
|
xmlFree(select);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ret = xmlXPathEvalExpression(select, ctxt->xpathCtxt);
|
ret = xmlXPathEvalExpression(select, ctxt->xpathCtxt);
|
||||||
|
xmlFree(select);
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
xsltGenericError(xsltGenericErrorContext,
|
xsltGenericError(xsltGenericErrorContext,
|
||||||
"exsltFuncResultElem: ret == NULL\n");
|
"exsltFuncResultElem: ret == NULL\n");
|
||||||
|
Reference in New Issue
Block a user