aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-05-02 16:19:18 +0100
committerGravatar Sadie Powell2024-05-03 09:28:33 +0100
commitc7ae694b50d1a1d7ed2b30967a1736633311e1a2 (patch)
treebaec1bab558f6d931d2287967645f06aae7f3ee4 /src/modules
parentUpdate irctest. (diff)
Deallocate the old MySQL connection on connect if one exists.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_mysql.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index f5337b938..2f5c64e43 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -334,6 +334,12 @@ class SQLConnection : public SQL::Provider
// true upon success.
bool Connect()
{
+ if (connection)
+ {
+ mysql_close(connection);
+ connection = NULL;
+ }
+
connection = mysql_init(connection);
// Set the connection timeout.