diff options
author | Jeroen BĂ©dorf <jeroen@bedorf.net> | 2015-04-02 12:04:31 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2015-04-30 15:53:53 +0200 |
commit | bf31003d74f538a9096ef5999b31b0daa58c38c9 (patch) | |
tree | e26a563adbdab2fdbadadc01c5be5f46171b4def | |
parent | 6fe3adab8ef3c9ab93a92c132f9809851a4dda74 (diff) | |
download | astra-bf31003d74f538a9096ef5999b31b0daa58c38c9.tar.gz astra-bf31003d74f538a9096ef5999b31b0daa58c38c9.tar.bz2 astra-bf31003d74f538a9096ef5999b31b0daa58c38c9.tar.xz astra-bf31003d74f538a9096ef5999b31b0daa58c38c9.zip |
Fix memory leak in the config
-rw-r--r-- | include/astra/Config.h | 2 | ||||
-rw-r--r-- | src/Config.cpp | 5 |
2 files changed, 7 insertions, 0 deletions
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; } } |