2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-30 22:05:46 +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:
Todd C. Miller
2018-10-13 07:31:34 -06:00
parent 75d9c6f165
commit fa7e6f3f04

View File

@@ -403,10 +403,14 @@ role_to_sudoers(struct sudoers_parse_tree *parse_tree, struct sudo_role *role,
struct cmndspec *cmndspec = TAILQ_FIRST(&priv->cmndlist);
/* Free duplicate runas lists. */
if (cmndspec->runasuserlist != NULL)
if (cmndspec->runasuserlist != NULL) {
free_members(cmndspec->runasuserlist);
if (cmndspec->runasgrouplist != NULL)
free(cmndspec->runasuserlist);
}
if (cmndspec->runasgrouplist != NULL) {
free_members(cmndspec->runasgrouplist);
free(cmndspec->runasgrouplist);
}
/* Update cmndspec with previous runas lists. */
TAILQ_FOREACH(cmndspec, &priv->cmndlist, entries) {