summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-06-06 18:24:07 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-06-06 18:24:07 +0100
commitde837a5d72eaa956c2d5f435ad91d5051ee714f1 (patch)
treef58d298c4b64d02274852a9d066b93650ffc4a10
parentPerform explicit init and tear down of libxml things (diff)
downloadproject2-de837a5d72eaa956c2d5f435ad91d5051ee714f1.tar.bz2
project2-de837a5d72eaa956c2d5f435ad91d5051ee714f1.tar.xz
project2-de837a5d72eaa956c2d5f435ad91d5051ee714f1.zip
Fix memory leak config variable
-rw-r--r--project2/common/variables/config.cpp15
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);