1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-04-24 18:50:07 +03:00

fixed memory leak in xpath error reporting

* xpath.c: fixed memory leak in xpath error reporting
This commit is contained in:
Aleksey Sanin 2006-05-31 20:53:43 +00:00
parent f79fbfc006
commit 1b2be101e8
2 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,7 @@
Wed May 31 13:53:41 PST 2006 Aleksey Sanin <aleksey@aleksey.com>
* xpath.c: fixed memory leak in xpath error reporting
Wed May 31 15:30:16 CEST 2006 Daniel Veillard <daniel@veillard.com>
* libxml.h triodef.h: applied patch from Olli Savia for LynxOS

20
xpath.c
View File

@ -368,6 +368,10 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
xmlXPathErrorMessages[error]);
return;
}
/* cleanup current last error */
xmlResetError(&ctxt->context->lastError);
ctxt->context->lastError.domain = XML_FROM_XPATH;
ctxt->context->lastError.code = error + XML_XPATH_EXPRESSION_OK -
XPATH_EXPRESSION_OK;
@ -1860,14 +1864,14 @@ xmlXPathFreeCache(xmlXPathContextCachePtr cache)
*
* Creates/frees an object cache on the XPath context.
* If activates XPath objects (xmlXPathObject) will be cached internally
* to be reused.
* @options:
* 0: This will set the XPath object caching:
* @value:
* This will set the maximum number of XPath objects
* to be reused.
* @options:
* 0: This will set the XPath object caching:
* @value:
* This will set the maximum number of XPath objects
* to be cached per slot
* There are 5 slots for: node-set, string, number, boolean, and
* misc objects. Use <0 for the default number (100).
* misc objects. Use <0 for the default number (100).
* Other values for @options have currently no effect.
*
* Returns 0 if the setting succeeded, and -1 on API or internal errors.
@ -1888,7 +1892,7 @@ xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
if (ctxt->cache == NULL)
return(-1);
}
cache = (xmlXPathContextCachePtr) ctxt->cache;
cache = (xmlXPathContextCachePtr) ctxt->cache;
if (options == 0) {
if (value < 0)
value = 100;
@ -1896,7 +1900,7 @@ xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
cache->maxString = value;
cache->maxNumber = value;
cache->maxBoolean = value;
cache->maxMisc = value;
cache->maxMisc = value;
}
} else if (ctxt->cache != NULL) {
xmlXPathFreeCache((xmlXPathContextCachePtr) ctxt->cache);