]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: Do not alter call-by-ref parameter on failure 3680/head
authorJouke Witteveen <j.witteveen@gmail.com>
Thu, 7 Jul 2016 10:41:52 +0000 (12:41 +0200)
committerJouke Witteveen <j.witteveen@gmail.com>
Fri, 8 Jul 2016 07:42:48 +0000 (09:42 +0200)
Prevent free from being called on (a part of) the call-by-reference
variable env when setup_pam fails.

src/core/execute.c

index 1a7620b0848c56882c7103260d8dccfb93fb3ba8..8c487b371f94a12263ef16934d05598af0b36933 100644 (file)
@@ -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;
         }