diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2012-10-07 17:19:30 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2012-10-08 02:18:14 +0200 |
commit | dce3988f9bc81d7291d56a4d838b434cd30bb5a9 (patch) | |
tree | 89910d7c1f08907909a75fcb77aa22aa5d39b625 | |
parent | 3af4f9b2bacfc8383001bba95c4f3836a6cecca6 (diff) | |
download | eurephia-dce3988f9bc81d7291d56a4d838b434cd30bb5a9.tar.gz eurephia-dce3988f9bc81d7291d56a4d838b434cd30bb5a9.tar.xz eurephia-dce3988f9bc81d7291d56a4d838b434cd30bb5a9.zip |
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 <dazo@users.sourceforge.net>
-rw-r--r-- | eurephiadm/eurephiadm.c | 3 | ||||
-rw-r--r-- | eurephiadm/xsltparser.c | 3 |
2 files changed, 5 insertions, 1 deletions
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 <libxslt/xslt.h> #include <libxslt/xsltInternals.h> #include <libxslt/transform.h> #include <libxslt/xsltutils.h> @@ -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; |