From c2f82b3d4e74ea632abcd4a12c19c0b20988570d Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Fri, 13 Feb 2026 11:20:07 +0000 Subject: [PATCH] Fix more Valgrind uninitialized value errors 1. MySQL_Logger.cpp: Initialize username_len, schemaname_len, and server_len to 0 in MySQL_Event constructor. These fields were uninitialized and used in copy constructor and JSON serialization. 2. debug.cpp: Add default member initializers to DebugLogEntry struct to ensure POD fields are zero-initialized. Move errno save/restore to after early return checks to avoid potential TLS access issues before thread is fully initialized. --- lib/MySQL_Logger.cpp | 3 +++ lib/debug.cpp | 17 ++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/MySQL_Logger.cpp b/lib/MySQL_Logger.cpp index fdacd8685..271abc949 100644 --- a/lib/MySQL_Logger.cpp +++ b/lib/MySQL_Logger.cpp @@ -353,6 +353,8 @@ MySQL_Event::MySQL_Event (log_event_type _et, uint32_t _thread_id, char * _usern thread_id=_thread_id; username=_username; schemaname=_schemaname; + username_len=0; + schemaname_len=0; start_time=_start_time; end_time=_end_time; query_digest=_query_digest; @@ -361,6 +363,7 @@ MySQL_Event::MySQL_Event (log_event_type _et, uint32_t _thread_id, char * _usern et=_et; hid=UINT64_MAX; server=NULL; + server_len=0; extra_info = NULL; have_affected_rows=false; affected_rows=0; diff --git a/lib/debug.cpp b/lib/debug.cpp index d8074c370..35fc52866 100644 --- a/lib/debug.cpp +++ b/lib/debug.cpp @@ -31,15 +31,15 @@ static unsigned int debug_output = 1; struct DebugLogEntry { - unsigned long long time; - unsigned long long lapse; - int thr; + unsigned long long time = 0; + unsigned long long lapse = 0; + int thr = 0; std::string file; - int line; + int line = 0; std::string funct; - int module; + int module = 0; std::string modname; - int verbosity; + int verbosity = 0; std::string message; std::string backtrace; }; @@ -178,20 +178,19 @@ void proxy_debug_func( const char *fmt, ... ) { - int saved_errno = errno; assert(module