From ce1b9cb4ba8917af1f2d16b20ab69a46af8fc5e4 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Fri, 5 Jul 2013 13:13:45 +0200 Subject: - 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 --- storage/connect/libdoc.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'storage/connect/libdoc.cpp') 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 -- cgit v1.2.1