summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-09-06 08:33:56 +0200
committerSergei Golubchik <sergii@pisem.net>2014-09-06 08:33:56 +0200
commit3da761912a6b243b1361a27d5b796cc53dfff3ec (patch)
treec566c164d2499b28b18ffee1dc4f3c32f5c8a8bd /sql/sql_repl.cc
parent9392d0e280c622c56d1b533762d8b577ed5b82c6 (diff)
downloadmariadb-git-3da761912a6b243b1361a27d5b796cc53dfff3ec.tar.gz
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.
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc6
1 files changed, 5 insertions, 1 deletions
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)))
{