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
4b9b128c
Commit
4b9b128c
authored
Jan 28, 2019
by
antirez
Browse files
ACL: remove leak when removing passwords/patterns.
parent
6cec82b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
4b9b128c
...
...
@@ -134,6 +134,11 @@ int ACLListMatchSds(void *a, void *b) {
return
sdscmp
(
a
,
b
)
==
0
;
}
/* Method to free list elements from ACL users password/ptterns lists. */
void
ACLListFreeSds
(
void
*
item
)
{
sdsfree
(
item
);
}
/* Create a new user with the specified name, store it in the list
* of users (the Users global radix tree), and returns a reference to
* the structure representing the user.
...
...
@@ -148,7 +153,9 @@ user *ACLCreateUser(const char *name, size_t namelen) {
u
->
passwords
=
listCreate
();
u
->
patterns
=
listCreate
();
listSetMatchMethod
(
u
->
passwords
,
ACLListMatchSds
);
listSetFreeMethod
(
u
->
passwords
,
ACLListFreeSds
);
listSetMatchMethod
(
u
->
patterns
,
ACLListMatchSds
);
listSetFreeMethod
(
u
->
patterns
,
ACLListFreeSds
);
memset
(
u
->
allowed_commands
,
0
,
sizeof
(
u
->
allowed_commands
));
raxInsert
(
Users
,(
unsigned
char
*
)
name
,
namelen
,
u
,
NULL
);
return
u
;
...
...
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