From c7ae694b50d1a1d7ed2b30967a1736633311e1a2 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 2 May 2024 16:19:18 +0100 Subject: Deallocate the old MySQL connection on connect if one exists. --- src/modules/extra/m_mysql.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/modules') 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. -- cgit v1.3.1-10-gc9f91