From 3da761912a6b243b1361a27d5b796cc53dfff3ec Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 6 Sep 2014 08:33:56 +0200 Subject: MDEV-6616 Server crashes in my_hash_first if shutdown is performed when FLUSH LOGS is running master_info_index becomes zero during shutdown. check that it's valid (under a mutex) before dereferencing. --- sql/sql_repl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sql/sql_repl.cc') diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 0f4a7c5133e..8a441dd2737 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -3226,6 +3226,9 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) LEX_MASTER_INFO* lex_mi= &thd->lex->mi; DBUG_ENTER("change_master"); + mysql_mutex_assert_owner(&LOCK_active_mi); + DBUG_ASSERT(master_info_index); + *master_info_added= false; /* We need to check if there is an empty master_host. Otherwise @@ -3632,7 +3635,8 @@ bool mysql_show_binlog_events(THD* thd) else /* showing relay log contents */ { mysql_mutex_lock(&LOCK_active_mi); - if (!(mi= master_info_index-> + if (!master_info_index || + !(mi= master_info_index-> get_master_info(&thd->variables.default_master_connection, Sql_condition::WARN_LEVEL_ERROR))) { -- cgit v1.2.1