summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bancache.cpp7
-rw-r--r--src/inspircd.cpp13
-rw-r--r--src/modules/m_callerid.cpp2
-rw-r--r--src/modules/m_httpd.cpp18
-rw-r--r--src/modules/m_permchannels.cpp6
-rw-r--r--src/users.cpp2
6 files changed, 29 insertions, 19 deletions
diff --git a/src/bancache.cpp b/src/bancache.cpp
index 0ca2d693f..efc181d22 100644
--- a/src/bancache.cpp
+++ b/src/bancache.cpp
@@ -158,3 +158,10 @@ void BanCacheManager::RehashCache()
delete BanHash;
BanHash = NewHash;
}
+
+BanCacheManager::~BanCacheManager()
+{
+ for (BanCacheHash::iterator n = BanHash->begin(); n != BanHash->end(); ++n)
+ delete n->second;
+ delete BanHash;
+}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 862aa31d0..8b1bd3e44 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -90,16 +90,13 @@ template<typename T> static void DeleteZero(T*&n)
void InspIRCd::Cleanup()
{
- if (Config)
+ for (unsigned int i = 0; i < ports.size(); i++)
{
- for (unsigned int i = 0; i < ports.size(); i++)
- {
- /* This calls the constructor and closes the listening socket */
- delete ports[i];
- }
-
- ports.clear();
+ /* This calls the constructor and closes the listening socket */
+ ports[i]->cull();
+ delete ports[i];
}
+ ports.clear();
/* Close all client sockets, or the new process inherits them */
std::vector<User*>::reverse_iterator i = Users->local_users.rbegin();
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index c356a2154..4a89f9948 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -93,7 +93,7 @@ struct CallerIDExtInfo : public ExtensionItem
callerid_data* get(User* user, bool create)
{
callerid_data* dat = static_cast<callerid_data*>(get_raw(user));
- if (!dat)
+ if (create && !dat)
{
dat = new callerid_data;
set_raw(user, dat);
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 2991b524e..76e89666a 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -60,10 +60,6 @@ class HttpServerSocket : public BufferedSocket
return index;
}
- ~HttpServerSocket()
- {
- }
-
virtual void OnError(BufferedSocketError)
{
}
@@ -347,6 +343,11 @@ class HttpListener : public ListenSocketBase
this->index = idx;
}
+ ~HttpListener()
+ {
+ delete index;
+ }
+
virtual void OnAcceptReady(int nfd)
{
int port;
@@ -383,7 +384,10 @@ class ModuleHttpServer : public Module
indexfile = c.ReadValue("http", "index", i);
index = new FileReader(indexfile);
if (!index->Exists())
+ {
+ delete index;
throw ModuleException("Can't read index file: "+indexfile);
+ }
http = new HttpListener(index, port, bindip);
httplisteners.push_back(http);
}
@@ -408,14 +412,14 @@ class ModuleHttpServer : public Module
{
for (size_t i = 0; i < httplisteners.size(); i++)
{
+ httplisteners[i]->cull();
delete httplisteners[i];
}
for (size_t i = 0; i < httpsocks.size(); i++)
{
- ServerInstance->SE->DelFd(httpsocks[i]);
- httpsocks[i]->Close();
- delete httpsocks[i]->GetIndex();
+ httpsocks[i]->cull();
+ delete httpsocks[i];
}
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 58a54f715..3f10bbeb8 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -185,7 +185,7 @@ public:
OnRehash(NULL);
}
- virtual ~ModulePermanentChannels()
+ CullResult cull()
{
/*
* DelMode can't remove the +P mode on empty channels, or it will break
@@ -200,12 +200,14 @@ public:
{
chan_hash::iterator at = iter;
iter++;
+ FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(c));
ServerInstance->chanlist->erase(at);
- delete c;
+ ServerInstance->GlobalCulls.AddItem(c);
}
else
iter++;
}
+ return Module::cull();
}
virtual void OnRehash(User *user)
diff --git a/src/users.cpp b/src/users.cpp
index 665f1d908..4707fdc39 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -44,7 +44,7 @@ class sent
}
~sent()
{
- delete array;
+ delete[] array;
}
};