diff options
author | Peter Powell <petpow@saberuk.com> | 2019-08-20 16:17:18 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-08-20 16:19:01 +0100 |
commit | 8745660fcdac7c1b80c94cfc0ff60928cd4dd4b7 (patch) | |
tree | e92bc6a0a62da27e9ea0395d48187606666b9676 | |
parent | 2d35c3396a1f00375d45b874dafb9e0bdb520a9b (diff) |
Initialise and deallocate the MySQL library correctly.
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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) |