2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 22:35:10 +00:00

fix double free introduced in rev 1.218

This commit is contained in:
Todd C. Miller
2007-12-31 21:23:46 +00:00
parent b289130680
commit 36b221af26

View File

@@ -311,17 +311,18 @@ display_privs(snl, pw)
#if defined(HAVE_INITGROUPS) && defined(HAVE_GETGROUPS)
/* XXX - refactor and call for display_cmnd too */
/* Set group vector so group matching works correctly. */
/* Reset group vector so group matching works correctly. */
if (pw != sudo_user.pw) {
(void) initgroups(pw->pw_name, pw->pw_gid);
efree(user_groups);
if ((user_ngroups = getgroups(0, NULL)) > 0) {
user_groups = erealloc3(user_groups, user_ngroups,
sizeof(GETGROUPS_T));
if (getgroups(user_ngroups, user_groups) < 0)
log_error(USE_ERRNO|MSG_ONLY, "can't get group vector");
} else
} else {
user_ngroups = 0;
efree(user_groups);
}
}
#endif