From: Aki Tuomi Date: Wed, 6 Sep 2023 05:34:51 +0000 (+0300) Subject: lib-sql: driver-mysql - Use API state to check if there is connection X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=371babad7a8abf87617c0040fcdd28ddc2dbf328;p=thirdparty%2Fdovecot%2Fcore.git lib-sql: driver-mysql - Use API state to check if there is connection db->mysql cannot be NULL. Broken in dd14131fcbd4b84f02316ecc0ff3a185683a5f23 --- diff --git a/src/lib-sql/driver-mysql.c b/src/lib-sql/driver-mysql.c index d8dd8d1283..2693a07105 100644 --- a/src/lib-sql/driver-mysql.c +++ b/src/lib-sql/driver-mysql.c @@ -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