From: Todd C. Miller Date: Sat, 13 Oct 2018 13:31:34 +0000 (-0600) Subject: Fix memory leak when reusing the runas list. We need to free the X-Git-Tag: SUDO_1_8_26^2~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa7e6f3f042448c806b8d7c433aa51e3b550916f;p=sudo Fix memory leak when reusing the runas list. We need to free the member list itself as well as its contents. --- diff --git a/plugins/sudoers/parse_ldif.c b/plugins/sudoers/parse_ldif.c index 0b07b7c4c..1beb82087 100644 --- a/plugins/sudoers/parse_ldif.c +++ b/plugins/sudoers/parse_ldif.c @@ -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) {