diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-07-09 15:00:31 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-07-09 15:00:31 +0200 |
commit | 3a67168036e1d8e0406c66c3ccf37812228a9524 (patch) | |
tree | 2e891624fb5eeca40fd546e6fb32c5ca286cf7c4 | |
parent | 93786820aad505e00d5c1c07228ef7aa6c3f22b8 (diff) |
core_whowas Delete elements of the per nick deque in the destructor of WhoWas::Nick
-rw-r--r-- | include/commands/cmd_whowas.h | 4 | ||||
-rw-r--r-- | src/coremods/core_whowas.cpp | 13 |
2 files changed, 9 insertions, 8 deletions
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index b058ef37d..2a3fa896c 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -39,6 +39,10 @@ namespace WhoWas /** Container where each element has information about one occurrence of this nick */ whowas_set entries; + + /** Destructor, deallocates all elements in the entries container + */ + ~Nick(); }; } diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp index 801f1186e..0a418df3e 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -118,8 +118,6 @@ void CommandWhowas::AddToWhoWas(User* user) if (it != whowas.end()) { WhoWas::Nick* set = it->second; - stdalgo::delete_all(set->entries); - delete set; whowas.erase(it); } @@ -162,8 +160,6 @@ void CommandWhowas::Prune() } WhoWas::Nick* nick = iter->second; - stdalgo::delete_all(nick->entries); - delete nick; whowas.erase(iter); whowas_fifo.pop_front(); @@ -204,10 +200,6 @@ CommandWhowas::~CommandWhowas() for (whowas_users::iterator i = whowas.begin(); i != whowas.end(); ++i) { WhoWas::Nick* nick = i->second; - whowas_set* set = &nick->entries; - for (whowas_set::iterator j = set->begin(); j != set->end(); ++j) - delete *j; - delete nick; } } @@ -217,6 +209,11 @@ WhoWasGroup::WhoWasGroup(User* user) : host(user->host), dhost(user->dhost), ide { } +WhoWas::Nick::~Nick() +{ + stdalgo::delete_all(entries); +} + class ModuleWhoWas : public Module { CommandWhowas cmd; |