summaryrefslogtreecommitdiff
path: root/xpath.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-11-29 13:08:03 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-11-29 13:08:03 +0000
commit7eca35fbaef6bd06074c4b978d381303609fcb0b (patch)
tree573210a01223727f5de88342f5484599fa55970a /xpath.c
parent66e40b14d5c8f4700312d8704e09902c7ddfc240 (diff)
downloadlibxml2-7eca35fbaef6bd06074c4b978d381303609fcb0b.tar.gz
fixed a memory leak on errors in some circumstances #159812 Daniel
* xpath.c: fixed a memory leak on errors in some circumstances #159812 Daniel
Diffstat (limited to 'xpath.c')
-rw-r--r--xpath.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xpath.c b/xpath.c
index 8afbb34b..20e38f48 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3917,9 +3917,12 @@ xmlXPathNewContext(xmlDocPtr doc) {
*/
void
xmlXPathFreeContext(xmlXPathContextPtr ctxt) {
+ if (ctxt == NULL) return;
+
xmlXPathRegisteredNsCleanup(ctxt);
xmlXPathRegisteredFuncsCleanup(ctxt);
xmlXPathRegisteredVariablesCleanup(ctxt);
+ xmlResetError(&ctxt->lastError);
xmlFree(ctxt);
}