summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/commands/cmd_whowas.h4
-rw-r--r--src/coremods/core_whowas.cpp13
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;