1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-8280: crash in 'show global status' with --skip-grant-tables

The crash was caused by attempting to use a hashtable without
it getting initialized, due to the --skip-grant-tables switch.
This commit is contained in:
Vicențiu Ciorbaru
2015-06-22 08:44:46 +03:00
parent cbb8b2d033
commit 0357791e3c
3 changed files with 24 additions and 5 deletions

View File

@ -10383,11 +10383,14 @@ static int show_column_grants(THD *thd, SHOW_VAR *var, char *buff,
var->type= SHOW_ULONG;
var->value= buff;
*(ulong *)buff= 0;
mysql_rwlock_rdlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
my_hash_iterate(&column_priv_hash, count_column_grants, buff);
mysql_mutex_unlock(&acl_cache->lock);
mysql_rwlock_unlock(&LOCK_grant);
if (initialized)
{
mysql_rwlock_rdlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
my_hash_iterate(&column_priv_hash, count_column_grants, buff);
mysql_mutex_unlock(&acl_cache->lock);
mysql_rwlock_unlock(&LOCK_grant);
}
return 0;
}