summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2016-08-16 11:25:11 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2016-08-23 21:24:36 +0300
commit4eb898bb1663ab470a07e8419de4aa14b5afc667 (patch)
tree81bb1fe2e773e70bfcd4c3500d54333cf7f3ef2d /sql/slave.cc
parent4da2b83af712492e4c3cb85e0005cde8511fa810 (diff)
downloadmariadb-git-4eb898bb1663ab470a07e8419de4aa14b5afc667.tar.gz
MDEV-10563 Crash during shutdown in Master_info_index::any_slave_sql_running
In well defined C code, the "this" pointer is never NULL. Currently, we were potentially dereferencing a NULL pointer (master_info_index). GCC v6 removes any "if (!this)" conditions as it assumes this is always a non-null pointer. In order to prevent undefined behaviour, check the pointer before dereferencing and remove the check within member functions.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index d8ec946ad16..6dc1a66a2ac 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -649,6 +649,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
mysql_mutex_unlock(log_lock);
}
if (opt_slave_parallel_threads > 0 &&
+ master_info_index &&// master_info_index is set to NULL on server shutdown
!master_info_index->any_slave_sql_running())
rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))