summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_mysql.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index fe23eee8c..63ed7d540 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -594,9 +594,19 @@ void ConnectDatabases(InspIRCd* ServerInstance)
}
}
+void ClearDatabases()
+{
+ ConnMap::iterator i;
+ while ((i = Connections.begin()) != Connections.end())
+ {
+ Connections.erase(i);
+ delete i->second;
+ }
+}
+
void LoadDatabases(ConfigReader* ThisConf, InspIRCd* ServerInstance)
{
- Connections.clear();
+ ClearDatabases();
for (int j =0; j < ThisConf->Enumerate("database"); j++)
{
std::string db = ThisConf->ReadValue("database","name",j);
@@ -793,6 +803,8 @@ class ModuleSQL : public Module
virtual ~ModuleSQL()
{
+ giveup = true;
+ ClearDatabases();
DELETE(Conf);
}