diff --git a/src/zm_db.cpp b/src/zm_db.cpp index 7224241b4..7db61e157 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -107,8 +107,8 @@ bool zmDbConnect() { } void zmDbClose() { + std::lock_guard lck(db_mutex); if (zmDbConnected) { - std::lock_guard lck(db_mutex); mysql_close(&dbconn); // mysql_init() call implicitly mysql_library_init() but // mysql_close() does not call mysql_library_end()