summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2014-09-25 19:14:16 +0400
committerSergei Petrunia <psergey@askmonty.org>2014-09-25 19:14:16 +0400
commit30fab5fb511ac29dcaef1f17a653f461ab32f029 (patch)
tree034ffc26320a9db4872b08b2fde363f94109ca30 /sql
parent532334cb11835d18f2705ecfd014659b4a2e8252 (diff)
downloadmariadb-git-30fab5fb511ac29dcaef1f17a653f461ab32f029.tar.gz
MDEV-6788: The variable 'role' is being used without being initialized at sql_acl.cc:8840
[re-commit in git] Second variant of the fix: reduce the scope of 'role' variable
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 258522329d2..bae2d15ba20 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -8687,7 +8687,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
int elements;
const char *UNINIT_VAR(user);
const char *UNINIT_VAR(host);
- const char *role;
ACL_USER *acl_user= NULL;
ACL_ROLE *acl_role= NULL;
ACL_DB *acl_db= NULL;
@@ -8827,7 +8826,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
role_grant_pair= (ROLE_GRANT_PAIR *) my_hash_element(roles_mappings_hash, idx);
user= role_grant_pair->u_uname;
host= role_grant_pair->u_hname;
- role= role_grant_pair->r_uname;
break;
default:
@@ -8845,8 +8843,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
if (struct_no == ROLES_MAPPINGS_HASH)
{
- if (! role)
- role= "";
+ const char* role= role_grant_pair->r_uname? role_grant_pair->r_uname: "";
if (user_from->is_role() ? strcmp(user_from->user.str, role) :
(strcmp(user_from->user.str, user) ||
my_strcasecmp(system_charset_info, user_from->host.str, host)))