From 4fb73505b92bed2c7f33272b67c2fbd2511e52a3 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 31 Mar 2021 12:05:30 -0400 Subject: [PATCH] backport change to not initialize db in logger which fixes small memleak. --- src/zm_db.h | 2 ++ src/zm_logger.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/zm_db.h b/src/zm_db.h index c707ad2b7..1f8273fc1 100644 --- a/src/zm_db.h +++ b/src/zm_db.h @@ -43,6 +43,8 @@ class zmDbRow { extern MYSQL dbconn; extern RecursiveMutex db_mutex; +extern bool zmDbConnected; + bool zmDbConnect(); void zmDbClose(); diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index 011a0166e..654e3e21f 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -361,7 +361,7 @@ Logger::Level Logger::databaseLevel(Logger::Level databaseLevel) { databaseLevel = limit(databaseLevel); if ( mDatabaseLevel != databaseLevel ) { if ( (databaseLevel > NOLOG) && (mDatabaseLevel <= NOLOG) ) { // <= NOLOG would be NOOPT - if ( !zmDbConnect() ) { + if ( !zmDbConnected ) { databaseLevel = NOLOG; } } // end if ( databaseLevel > NOLOG && mDatabaseLevel <= NOLOG )