summaryrefslogtreecommitdiff
path: root/storage/connect/libdoc.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-07-05 13:13:45 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2013-07-05 13:13:45 +0200
commitce1b9cb4ba8917af1f2d16b20ab69a46af8fc5e4 (patch)
treefcbb4d723d8bd3b4f343712266c278b0149f87c1 /storage/connect/libdoc.cpp
parent923eddcfe12d015c43ee6422f32e000aadc714b8 (diff)
downloadmariadb-git-ce1b9cb4ba8917af1f2d16b20ab69a46af8fc5e4.tar.gz
- Try to fix a uninitialised valgrind warning
modified: storage/connect/ha_connect.cc storage/connect/ha_connect.h storage/connect/mycat.cc - Fix a regression error on XML libdoc wrong Nlist freing modified: storage/connect/domdoc.h storage/connect/libdoc.cpp storage/connect/libdoc.h storage/connect/plgxml.h storage/connect/tabxml.cpp
Diffstat (limited to 'storage/connect/libdoc.cpp')
-rw-r--r--storage/connect/libdoc.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
index 02b931e2dc2..6e69322425e 100644
--- a/storage/connect/libdoc.cpp
+++ b/storage/connect/libdoc.cpp
@@ -146,6 +146,8 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
Nlist = NULL;
Ctxp = NULL;
Xop = NULL;
+ Buf = NULL;
+ Nofreelist = false;
} // end of LIBXMLDOC constructor
/******************************************************************/
@@ -347,6 +349,9 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
htrc("CloseDoc: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
if (xp && xp->Count == 1) {
+ if (Nlist)
+ xmlXPathFreeNodeSet(Nlist);
+
if (Xop)
xmlXPathFreeObject(Xop);
@@ -410,8 +415,13 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
if (trace)
htrc("Calling xmlXPathFreeNodeSetList Xop=%p\n", Xop);
- xmlXPathFreeObject(Xop);
-// xmlXPathFreeNodeSetList(Xop); // Caused memory leak
+ if (Nofreelist) {
+ // Making Nlist that must not be freed yet
+ xmlXPathFreeNodeSetList(Xop); // Caused memory leak
+ Nofreelist = false;
+ } else
+ xmlXPathFreeObject(Xop); // Caused node not found
+
} // endif Ctxp
// Set the context to the calling node