]> granicus.if.org Git - sudo/commitdiff
Fix memory leak on error, CID 185602
authorTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 16 May 2018 16:45:00 +0000 (10:45 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 16 May 2018 16:45:00 +0000 (10:45 -0600)
plugins/sudoers/ldap_util.c

index 4e47eccc86e80c2868fa7aa55d766d4afcfd5088..21f5d8527d34e9c7507b4d6e4e77c92bc4af2143 100644 (file)
@@ -339,6 +339,7 @@ sudo_ldap_role_to_priv(const char *cn, void *hosts, void *runasusers,
                free(m);
                goto oom;
            }
+           m->name = (char *)c;
        }
 
        /* Negated commands have precedence so insert them at the end. */
@@ -492,7 +493,6 @@ sudo_ldap_role_to_priv(const char *cn, void *hosts, void *runasusers,
            char *args;
 
            m->type = COMMAND;
-           m->name = (char *)c;
 
            /* Fill in command with optional digest. */
            if (sudo_ldap_extract_digest(&cmnd, &digest) != NULL) {