mirror of https://github.com/redis/redis.git
				
				
				
			ACL: Fix memory leak in ACLResetSubcommandsForCommand().
This commit fixes bug reported at #5998. Thanks to @tomcat1102.
This commit is contained in:
		
							parent
							
								
									f8a9708aa7
								
							
						
					
					
						commit
						c24e32041b
					
				|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue