Skip to content
Permalink
Browse files Browse the repository at this point in the history
Initialise and deallocate the MySQL library correctly.
  • Loading branch information
SadieCat committed Aug 20, 2019
1 parent 2d35c33 commit 8745660
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/extra/m_mysql.cpp
Expand Up @@ -412,6 +412,9 @@ ModuleSQL::ModuleSQL()

void ModuleSQL::init()
{
if (mysql_library_init(0, NULL, NULL))
throw ModuleException("Unable to initialise the MySQL library!");

Dispatcher = new DispatcherThread(this);
ServerInstance->Threads.Start(Dispatcher);
}
Expand All @@ -424,10 +427,13 @@ ModuleSQL::~ModuleSQL()
Dispatcher->OnNotify();
delete Dispatcher;
}

for(ConnMap::iterator i = connections.begin(); i != connections.end(); i++)
{
delete i->second;
}

mysql_library_end();
}

void ModuleSQL::ReadConfig(ConfigStatus& status)
Expand Down

0 comments on commit 8745660

Please sign in to comment.