From dce3988f9bc81d7291d56a4d838b434cd30bb5a9 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Sun, 7 Oct 2012 17:19:30 +0200 Subject: eurephiadm: Fixed some memory cleanup with libxml2 and libxslt Valgrind complained about reachable buffers within the libxml2 and libxslt functions. Found some init and cleanup functions which needed to be called to solve this. Signed-off-by: David Sommerseth --- eurephiadm/eurephiadm.c | 3 ++- eurephiadm/xsltparser.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/eurephiadm/eurephiadm.c b/eurephiadm/eurephiadm.c index 340ac08..87aa1c0 100644 --- a/eurephiadm/eurephiadm.c +++ b/eurephiadm/eurephiadm.c @@ -532,7 +532,6 @@ int main(int argc, char **argv) { return rc; } - // // Load database driver, setup a context and create or reuse an open session // and then call the commando's function @@ -617,5 +616,7 @@ int main(int argc, char **argv) { eFree_values(ctx, cfg); eDBdisconnect(ctx); eurephiaCTX_destroy(ctx); + + xmlCleanupParser(); return rc; } diff --git a/eurephiadm/xsltparser.c b/eurephiadm/xsltparser.c index 1168755..0538e1e 100644 --- a/eurephiadm/xsltparser.c +++ b/eurephiadm/xsltparser.c @@ -36,6 +36,7 @@ #endif #ifdef HAVE_LIBXSLT +#include #include #include #include @@ -68,6 +69,7 @@ int xslt_print_xmldoc(FILE *dst, eurephiaVALUES *cfg, xmlDoc *xmldoc, xmlStrPrintf(xsltfile,2046, (xmlChar *)"%s/%s%c", eGet_value(cfg, "eurephiadm_xslt_path"), xsltfname, 0); // Load the XSLT template + xsltInit(); xslt = xsltParseStylesheetFile(xsltfile); if( xslt == NULL ) { return 0; @@ -85,6 +87,7 @@ int xslt_print_xmldoc(FILE *dst, eurephiaVALUES *cfg, xmlDoc *xmldoc, // Clean up xmlFreeDoc(result); xsltFreeStylesheet(xslt); + xsltCleanupGlobals(); return 1; #else return 0; -- cgit