Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c24e3204
Commit
c24e3204
authored
Apr 08, 2019
by
antirez
Browse files
ACL: Fix memory leak in ACLResetSubcommandsForCommand().
This commit fixes bug reported at #5998. Thanks to @tomcat1102.
parent
f8a9708a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
c24e3204
...
...
@@ -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;
}
...
...
tests/unit/acl.tcl
View file @
c24e3204
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment