2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Don't free the private copy of the environment until the close function.

We may need to use it when logging from the audit reject function.
This commit is contained in:
Todd C. Miller
2020-11-17 13:44:32 -07:00
parent cb87253d1e
commit 7d0b19d2a0
2 changed files with 8 additions and 5 deletions

View File

@@ -756,16 +756,16 @@ bad:
ret = false;
done:
/* Store settings to pass back to front-end. */
if (ret != -1) {
if (ret == -1) {
/* Free stashed copy of the environment. */
(void)env_init(NULL);
} else {
/* Store settings to pass back to front-end. */
if (!sudoers_policy_store_result(ret, NewArgv, env_get(), cmnd_umask,
iolog_path, closure))
ret = -1;
}
/* Zero out stashed copy of environment, it is owned by the front-end. */
(void)env_init(NULL);
if (!rewind_perms())
ret = -1;