Memory leak fixed

This commit is contained in:
Nekotekina 2015-12-06 20:18:15 +03:00
parent 8e4ad3dfcb
commit 717d99795c
2 changed files with 2 additions and 17 deletions

View file

@ -163,16 +163,3 @@ std::string config_context_t::to_string() const
return result.str();
}
void config_context_t::add_group(const std::string& name)
{
new group(this, name);
}
config_context_t::group& config_context_t::get_group(const std::string& name)
{
if (!m_groups[name])
add_group(name);
return *m_groups[name];
}

View file

@ -14,6 +14,7 @@ protected:
group* m_parent;
config_context_t* m_cfg;
std::string m_name;
std::vector<std::unique_ptr<entry_base>> m_entries;
void init();
@ -30,7 +31,7 @@ protected:
template<typename T>
void add_entry(const std::string& name, const T& def_value)
{
new entry<T>(this, name, def_value);
m_entries.emplace_back(std::make_unique<entry<T>>(this, name, def_value));
}
template<typename T>
@ -158,7 +159,4 @@ public:
void set_defaults();
std::string to_string() const;
void add_group(const std::string& name);
group& get_group(const std::string& name);
};