mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-11 11:39:02 -04:00
Fix mem leakage in reading in and connecting to databases and have destructor call mem cleanup too and end the endless loop too so /RESTART and /DIE works with no segfault.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6144 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
125f9c37da
commit
486ac00566
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user