]> granicus.if.org Git - sudo/commitdiff
Fix memory leak when reusing the runas list. We need to free the
authorTodd C. Miller <Todd.Miller@sudo.ws>
Sat, 13 Oct 2018 13:31:34 +0000 (07:31 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Sat, 13 Oct 2018 13:31:34 +0000 (07:31 -0600)
member list itself as well as its contents.

plugins/sudoers/parse_ldif.c

index 0b07b7c4cf355738ccd3aa4c8b88f72f24a4d2d9..1beb82087cd491102078048394c5cdc761bce1c5 100644 (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) {