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.
v3.0-test0213
Rene Cannao 6 days ago
parent fdbea2a32e
commit 4e39297ef9

@ -22,7 +22,13 @@ template void Base_Thread::register_session(PgSQL_Thread*, PgSQL_Session*, bool)
template void Base_Thread::run_SetAllSession_ToProcess0<MySQL_Thread, MySQL_Session>();
template void Base_Thread::run_SetAllSession_ToProcess0<PgSQL_Thread, PgSQL_Session>();
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() {

@ -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) {

Loading…
Cancel
Save