From 8745660fcdac7c1b80c94cfc0ff60928cd4dd4b7 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 20 Aug 2019 16:17:18 +0100 Subject: Initialise and deallocate the MySQL library correctly. --- src/modules/extra/m_mysql.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index c50d2abf5..7b6e2906d 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -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); } @@ -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) -- cgit v1.2.3