summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2016-07-07 12:41:52 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2016-07-08 09:42:48 +0200
commit84eada2f7fc1b9039f783653c592e52f5ccab48f (patch)
tree0e7736c87eab2764e6eb2c381c0dddb83dc4dd5e /src/core
parent1280503b7e74cacfa091f7e270a89c5811388c2b (diff)
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.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/execute.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 1a7620b084..8c487b371f 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -835,7 +835,7 @@ static int setup_pam(
pam_handle_t *handle = NULL;
sigset_t old_ss;
int pam_code = PAM_SUCCESS, r;
- char **e = NULL;
+ char **nv, **e = NULL;
bool close_session = false;
pid_t pam_pid = 0, parent_pid;
int flags = 0;
@@ -870,8 +870,8 @@ static int setup_pam(
goto fail;
}
- STRV_FOREACH(e, *env) {
- pam_code = pam_putenv(handle, *e);
+ STRV_FOREACH(nv, *env) {
+ pam_code = pam_putenv(handle, *nv);
if (pam_code != PAM_SUCCESS)
goto fail;
}