execute: Do not alter call-by-ref parameter on failure
Prevent free from being called on (a part of) the call-by-reference variable env when setup_pam fails.
This commit is contained in:
parent
1280503b7e
commit
84eada2f7f
|
@ -835,7 +835,7 @@ static int setup_pam(
|
||||||
pam_handle_t *handle = NULL;
|
pam_handle_t *handle = NULL;
|
||||||
sigset_t old_ss;
|
sigset_t old_ss;
|
||||||
int pam_code = PAM_SUCCESS, r;
|
int pam_code = PAM_SUCCESS, r;
|
||||||
char **e = NULL;
|
char **nv, **e = NULL;
|
||||||
bool close_session = false;
|
bool close_session = false;
|
||||||
pid_t pam_pid = 0, parent_pid;
|
pid_t pam_pid = 0, parent_pid;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
@ -870,8 +870,8 @@ static int setup_pam(
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRV_FOREACH(e, *env) {
|
STRV_FOREACH(nv, *env) {
|
||||||
pam_code = pam_putenv(handle, *e);
|
pam_code = pam_putenv(handle, *nv);
|
||||||
if (pam_code != PAM_SUCCESS)
|
if (pam_code != PAM_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue