From b4074069b2a89a14d9406f4c10c92811cdd78c79 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 21 Sep 2021 19:14:07 +0200 Subject: [PATCH] MDEV-26657 : Initialize some fields in create_background_thd() Avoid reading uninitialized memory by thd_get_error_context_description(). Note, that THD::real_id can't be initialized at this stage, so it will be zeroed. --- sql/sql_class.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0d9a8439ccb..883e9c688ff 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4922,6 +4922,9 @@ MYSQL_THD create_background_thd() thd->set_command(COM_DAEMON); thd->system_thread= SYSTEM_THREAD_GENERIC; thd->security_ctx->host_or_ip= ""; + thd->real_id= 0; + thd->thread_id= 0; + thd->query_id= 0; return thd; }