summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog4
-rw-r--r--xpath.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f8ddb4ed..53878a8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Nov 29 14:07:18 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+ * xpath.c: fixed a memory leak on errors in some circumstances #159812
+
Fri Nov 26 23:20:48 HKT 2004 William Brack <wbrack@mmm.com.hk>
* xmlIO.c: added a check within xmlOutputBufferWriteEscape to prevent
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);
}