Skip to content

Commit 8745660

Browse files
committed
Initialise and deallocate the MySQL library correctly.
1 parent 2d35c33 commit 8745660

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
@@ -412,6 +412,9 @@ ModuleSQL::ModuleSQL()
412412

413413
void ModuleSQL::init()
414414
{
415+
if (mysql_library_init(0, NULL, NULL))
416+
throw ModuleException("Unable to initialise the MySQL library!");
417+
415418
Dispatcher = new DispatcherThread(this);
416419
ServerInstance->Threads.Start(Dispatcher);
417420
}
@@ -424,10 +427,13 @@ ModuleSQL::~ModuleSQL()
424427
Dispatcher->OnNotify();
425428
delete Dispatcher;
426429
}
430+
427431
for(ConnMap::iterator i = connections.begin(); i != connections.end(); i++)
428432
{
429433
delete i->second;
430434
}
435+
436+
mysql_library_end();
431437
}
432438

433439
void ModuleSQL::ReadConfig(ConfigStatus& status)

0 commit comments

Comments
 (0)