From bf31003d74f538a9096ef5999b31b0daa58c38c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeroen=20B=C3=A9dorf?= Date: Thu, 2 Apr 2015 12:04:31 +0200 Subject: Fix memory leak in the config --- include/astra/Config.h | 2 ++ src/Config.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/astra/Config.h b/include/astra/Config.h index 9893c90..0230dbe 100644 --- a/include/astra/Config.h +++ b/include/astra/Config.h @@ -51,6 +51,8 @@ struct _AstraExport Config { XMLNode* self; XMLNode* global; + + XMLDocument *_doc; }; struct ConfigCheckData { diff --git a/src/Config.cpp b/src/Config.cpp index d860638..32e5ed9 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -48,6 +48,7 @@ using namespace std; Config::Config() { self = 0; + _doc = 0; } //----------------------------------------------------------------------------- @@ -55,6 +56,7 @@ Config::Config() Config::Config(XMLNode* _self) { self = _self; + _doc = 0; } //----------------------------------------------------------------------------- @@ -62,6 +64,8 @@ Config::~Config() { delete self; self = 0; + delete _doc; + _doc = 0; } //----------------------------------------------------------------------------- @@ -70,6 +74,7 @@ void Config::initialize(std::string rootname) if (self == 0) { XMLDocument* doc = XMLDocument::createDocument(rootname); self = doc->getRootNode(); + _doc = doc; } } -- cgit v1.2.3