summaryrefslogtreecommitdiff
path: root/src/acl.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-04-08 18:08:37 +0200
committerantirez <antirez@gmail.com>2019-04-08 18:08:37 +0200
commitc24e32041b91ac32626e8d8eee1c062942e25f27 (patch)
tree45893fde38f000bb7248a92dd10478d47c48b9da /src/acl.c
parentf8a9708aa705b6493ef63a82e42ed428997b817a (diff)
downloadredis-c24e32041b91ac32626e8d8eee1c062942e25f27.tar.gz
ACL: Fix memory leak in ACLResetSubcommandsForCommand().
This commit fixes bug reported at #5998. Thanks to @tomcat1102.
Diffstat (limited to 'src/acl.c')
-rw-r--r--src/acl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/acl.c b/src/acl.c
index d9f431f4f..0205e51ad 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -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;
}