]> 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)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 6 Sep 2023 12:12:54 +0000 (12:12 +0000)
db->mysql cannot be NULL.

Broken in 542877c08eb8130733567e5b718933bc3cdc8426

src/lib-sql/driver-mysql.c

index d8dd8d128357496de153ebf06a41232d575c9189..2693a07105baf6c91472bbdd9e48d82652a20986 100644 (file)
@@ -369,7 +369,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