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 b3dbf43 commit 2cc35d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/extra/m_mysql.cpp
Expand Up @@ -380,6 +380,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 @@ -397,10 +400,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::OnRehash(User* user)
Expand Down

0 comments on commit 2cc35d8

Please sign in to comment.