From c8fb911e9cab909ccfbf2a75cb90af501c819f5b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 28 Jun 2021 22:08:52 +0200 Subject: [PATCH] fix main.lock_kill crashes in --ps --embed when checking whether thd wasn't killed before this emb_advanced_command(), take into account that it could've been killed before the *previous* emb_advanced_command(). That is, the previous one has already set thd to NULL and this one only wanted a COM_STMT_RESET after a failure. --- libmysqld/lib_sql.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 5374c420fac..a8f554326cd 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -115,7 +115,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, NET *net= &mysql->net; my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE; - if (thd->killed != NOT_KILLED) + if (thd && thd->killed != NOT_KILLED) { if (thd->killed < KILL_CONNECTION) thd->killed= NOT_KILLED;