diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e67a019d1f7..258522329d2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -8687,7 +8687,7 @@ 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 *UNINIT_VAR(role); + const char *role; ACL_USER *acl_user= NULL; ACL_ROLE *acl_role= NULL; ACL_DB *acl_db= NULL; @@ -8837,8 +8837,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, user= ""; if (! host) host= ""; - if (! role) - role= ""; #ifdef EXTRA_DEBUG DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'", @@ -8847,6 +8845,8 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, if (struct_no == ROLES_MAPPINGS_HASH) { + if (! role) + role= ""; 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)))