Skip to content

Commit 2cc35d8

Browse files
committed
Initialise and deallocate the MySQL library correctly.
1 parent b3dbf43 commit 2cc35d8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: src/modules/extra/m_mysql.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ ModuleSQL::ModuleSQL()
380380

381381
void ModuleSQL::init()
382382
{
383+
if (mysql_library_init(0, NULL, NULL))
384+
throw ModuleException("Unable to initialise the MySQL library!");
385+
383386
Dispatcher = new DispatcherThread(this);
384387
ServerInstance->Threads->Start(Dispatcher);
385388

@@ -397,10 +400,13 @@ ModuleSQL::~ModuleSQL()
397400
Dispatcher->OnNotify();
398401
delete Dispatcher;
399402
}
403+
400404
for(ConnMap::iterator i = connections.begin(); i != connections.end(); i++)
401405
{
402406
delete i->second;
403407
}
408+
409+
mysql_library_end();
404410
}
405411

406412
void ModuleSQL::OnRehash(User* user)

0 commit comments

Comments
 (0)