]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sql: driver-mysql - Use API state to check if there is connection
authorAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 6 Sep 2023 05:34:51 +0000 (08:34 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 6 Sep 2023 10:14:58 +0000 (10:14 +0000)
db->mysql cannot be NULL.

Broken in d0a2a8fd48a6c844a69381552db85fced0ae1d48

src/lib-sql/driver-mysql.c

index 9a7855eebae802fb2d0d03becd0464ef4c771d20..94beef3140216a9c53bbe0ca17ad76ef35cfb4be 100644 (file)
@@ -371,7 +371,7 @@ driver_mysql_escape_string(struct sql_db *_db, const char *string)
                (void)sql_connect(&db->api);
        }
 
-       if (db->mysql == NULL) {
+       if (_db->state == SQL_DB_STATE_DISCONNECTED) {
                /* FIXME: we don't have a valid connection, so fallback
                   to using default escaping. the next query will most
                   likely fail anyway so it shouldn't matter that much