summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-11-01 11:48:55 -0800
committerunknown <jimw@mysql.com>2005-11-01 11:48:55 -0800
commita2370730b3ec287807c8920131b2ee1c554fa8f5 (patch)
tree948915d509f76a4da3543d099fefa029aebafd8d
parent75c45caf2e8831e0129f2726ac5f911442b5790e (diff)
downloadmariadb-git-a2370730b3ec287807c8920131b2ee1c554fa8f5.tar.gz
Avoid possible race condition in accessing slave statistics
during shutdown. (Bug #11796) sql/sql_show.cc: Check that active_mi is not NULL before accessing its members.
-rw-r--r--sql/sql_show.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index d6ceca5f23c..268292022e4 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1890,7 +1890,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
case SHOW_SLAVE_RUNNING:
{
pthread_mutex_lock(&LOCK_active_mi);
- end= strmov(buff, (active_mi->slave_running &&
+ end= strmov(buff, (active_mi && active_mi->slave_running &&
active_mi->rli.slave_running) ? "ON" : "OFF");
pthread_mutex_unlock(&LOCK_active_mi);
break;
@@ -1902,9 +1902,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
SLAVE STATUS, and have the sum over all lines here.
*/
pthread_mutex_lock(&LOCK_active_mi);
- pthread_mutex_lock(&active_mi->rli.data_lock);
- end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
- pthread_mutex_unlock(&active_mi->rli.data_lock);
+ if (active_mi)
+ {
+ pthread_mutex_lock(&active_mi->rli.data_lock);
+ end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
+ pthread_mutex_unlock(&active_mi->rli.data_lock);
+ }
pthread_mutex_unlock(&LOCK_active_mi);
break;
}