From 4e39297ef929b55803088d861bba673ca50f159c Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Fri, 13 Feb 2026 11:38:27 +0000 Subject: [PATCH] Fix more Valgrind uninitialized value errors 1. Base_Thread.cpp: Initialize member variables in constructor - curtime, last_move_to_idle_thread_time, epoll_thread, shutdown, mysql_sessions were not initialized, causing uninitialized value use in ProcessAllMyDS_BeforePoll and ProcessAllMyDS_AfterPoll. 2. MySQL_Logger.cpp: Initialize query_ptr, query_len, and buf in MySQL_Event constructor. These fields were used without initialization, causing Valgrind errors in JSON serialization and other operations. --- lib/Base_Thread.cpp | 8 +++++++- lib/MySQL_Logger.cpp | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Base_Thread.cpp b/lib/Base_Thread.cpp index 6a3966225..61cffa99f 100644 --- a/lib/Base_Thread.cpp +++ b/lib/Base_Thread.cpp @@ -22,7 +22,13 @@ template void Base_Thread::register_session(PgSQL_Thread*, PgSQL_Session*, bool) template void Base_Thread::run_SetAllSession_ToProcess0(); template void Base_Thread::run_SetAllSession_ToProcess0(); -Base_Thread::Base_Thread() { +Base_Thread::Base_Thread() : + curtime(0), + last_move_to_idle_thread_time(0), + epoll_thread(false), + shutdown(0), + mysql_sessions(nullptr) +{ }; Base_Thread::~Base_Thread() { diff --git a/lib/MySQL_Logger.cpp b/lib/MySQL_Logger.cpp index 271abc949..580ae7636 100644 --- a/lib/MySQL_Logger.cpp +++ b/lib/MySQL_Logger.cpp @@ -358,6 +358,8 @@ MySQL_Event::MySQL_Event (log_event_type _et, uint32_t _thread_id, char * _usern start_time=_start_time; end_time=_end_time; query_digest=_query_digest; + query_ptr=NULL; + query_len=0; client=_client; client_len=_client_len; et=_et; @@ -377,6 +379,7 @@ MySQL_Event::MySQL_Event (log_event_type _et, uint32_t _thread_id, char * _usern errmsg = nullptr; myerrno = 0; free_on_delete = false; // by default, this is false. This because pointers do not belong to this object + memset(buf, 0, sizeof(buf)); } MySQL_Event::MySQL_Event(const MySQL_Event &other) {