mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-04 16:25:25 +00:00
Fix memory leak when reusing the runas list. We need to free the
member list itself as well as its contents.
This commit is contained in:
@@ -403,10 +403,14 @@ role_to_sudoers(struct sudoers_parse_tree *parse_tree, struct sudo_role *role,
|
|||||||
struct cmndspec *cmndspec = TAILQ_FIRST(&priv->cmndlist);
|
struct cmndspec *cmndspec = TAILQ_FIRST(&priv->cmndlist);
|
||||||
|
|
||||||
/* Free duplicate runas lists. */
|
/* Free duplicate runas lists. */
|
||||||
if (cmndspec->runasuserlist != NULL)
|
if (cmndspec->runasuserlist != NULL) {
|
||||||
free_members(cmndspec->runasuserlist);
|
free_members(cmndspec->runasuserlist);
|
||||||
if (cmndspec->runasgrouplist != NULL)
|
free(cmndspec->runasuserlist);
|
||||||
|
}
|
||||||
|
if (cmndspec->runasgrouplist != NULL) {
|
||||||
free_members(cmndspec->runasgrouplist);
|
free_members(cmndspec->runasgrouplist);
|
||||||
|
free(cmndspec->runasgrouplist);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update cmndspec with previous runas lists. */
|
/* Update cmndspec with previous runas lists. */
|
||||||
TAILQ_FOREACH(cmndspec, &priv->cmndlist, entries) {
|
TAILQ_FOREACH(cmndspec, &priv->cmndlist, entries) {
|
||||||
|
Reference in New Issue
Block a user