Commit c24e3204 authored by antirez's avatar antirez
Browse files

ACL: Fix memory leak in ACLResetSubcommandsForCommand().

This commit fixes bug reported at #5998. Thanks to @tomcat1102.
parent f8a9708a
......@@ -542,6 +542,8 @@ struct redisCommand *ACLLookupCommand(const char *name) {
* and command ID. */
void ACLResetSubcommandsForCommand(user *u, unsigned long id) {
if (u->allowed_subcommands && u->allowed_subcommands[id]) {
for (int i = 0; u->allowed_subcommands[id][i]; i++)
sdsfree(u->allowed_subcommands[id][i]);
zfree(u->allowed_subcommands[id]);
u->allowed_subcommands[id] = NULL;
}
......
......@@ -109,7 +109,7 @@ start_server {tags {"acl"}} {
assert_match {*+acl*} $cmdstr
}
test {ACL regression: memory leaks adding / removing subcommands} {
test {ACL #5998 regression: memory leaks adding / removing subcommands} {
r AUTH default ""
r ACL setuser newuser reset -debug +debug|a +debug|b +debug|c
r ACL setuser newuser -debug
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment