diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-06 18:24:07 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-06 18:24:07 +0100 |
commit | de837a5d72eaa956c2d5f435ad91d5051ee714f1 (patch) | |
tree | f58d298c4b64d02274852a9d066b93650ffc4a10 | |
parent | Perform explicit init and tear down of libxml things (diff) | |
download | project2-de837a5d72eaa956c2d5f435ad91d5051ee714f1.tar.bz2 project2-de837a5d72eaa956c2d5f435ad91d5051ee714f1.tar.xz project2-de837a5d72eaa956c2d5f435ad91d5051ee714f1.zip |
Fix memory leak config variable
-rw-r--r-- | project2/common/variables/config.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/project2/common/variables/config.cpp b/project2/common/variables/config.cpp index 5b36f6e..e134d07 100644 --- a/project2/common/variables/config.cpp +++ b/project2/common/variables/config.cpp @@ -69,18 +69,23 @@ class VariableConfigLoader : public VariableLoader::For<VariableConfig> { } }; VariableConfigLoader() : - opts("Variables - ModConfig options") + opts(new Options("Variables - ModConfig options")) { - opts(new AppSettings()); - OptionsSets::Add(typeid(AppSettings).name(), &opts); + (*opts)(new AppSettings()); + OptionsSets::Add(typeid(AppSettings).name(), opts); + } + + ~VariableConfigLoader() + { + OptionsSets::Remove(typeid(AppSettings).name()); } const Options * options() const { - return &opts; + return opts; } private: - Options opts; + Options * opts; }; DECLARE_CUSTOM_COMPONENT_LOADER("config", VariableConfigLoader, VariableConfigLoader, VariableLoader); |