From 1e917014ae92493e14e5ad10305139d71162d0e0 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sat, 13 Mar 2010 22:37:30 +0000 Subject: Fix uninit pointer on MySQL initial connection git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12635 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_mysql.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index b4d7cd7c6..d58b762ae 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -229,7 +229,7 @@ class SQLConnection : public SQLProvider // This constructor creates an SQLConnection object with the given credentials, but does not connect yet. SQLConnection(Module* p, ConfigTag* tag) : SQLProvider(p, "SQL/" + tag->getString("id")), - config(tag) + config(tag), connection(NULL) { } @@ -288,11 +288,9 @@ class SQLConnection : public SQLProvider bool CheckConnection() { - if (mysql_ping(connection) != 0) - { + if (!connection || mysql_ping(connection) != 0) return Connect(); - } - else return true; + return true; } std::string GetError() -- cgit v1.2.3