summaryrefslogtreecommitdiff
path: root/sql/sql_parse.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_parse.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_parse.cc')
-rw-r--r--sql/sql_parse.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 30fcac6e12a..4edbd3ba5be 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2693,6 +2693,9 @@ case SQLCOM_PREPARE:
goto error;
mysql_mutex_lock(&LOCK_active_mi);
+ if (!master_info_index)
+ goto error;
+
mi= master_info_index->get_master_info(&lex_mi->connection_name,
Sql_condition::WARN_LEVEL_NOTE);
@@ -3150,7 +3153,7 @@ end_with_restore_list:
case SQLCOM_SLAVE_ALL_START:
{
mysql_mutex_lock(&LOCK_active_mi);
- if (!master_info_index->start_all_slaves(thd))
+ if (master_info_index && !master_info_index->start_all_slaves(thd))
my_ok(thd);
mysql_mutex_unlock(&LOCK_active_mi);
break;
@@ -3166,7 +3169,7 @@ end_with_restore_list:
goto error;
}
mysql_mutex_lock(&LOCK_active_mi);
- if (!master_info_index->stop_all_slaves(thd))
+ if (master_info_index && !master_info_index->stop_all_slaves(thd))
my_ok(thd);
mysql_mutex_unlock(&LOCK_active_mi);
break;