Fix: worker structure is leaked in run_as process
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 6 Dec 2018 20:49:04 +0000 (15:49 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 21 Jan 2019 21:29:50 +0000 (16:29 -0500)
The run_as structure (handle) is allocated and initialized before
the fork() that spawns the run_as process. Currently, that structure
is only cleaned-up on the parent's end.

This fix performs the clean-up on the worker's side as well.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/runas.c

index 562d4e348f2fcb81e088a1d25e913211879ed64a..1f2a836308e5006565c7eea73a436da2d558e57f 100644 (file)
@@ -661,6 +661,7 @@ int run_as_create_worker(char *procname)
                        ret = -1;
                }
                worker->sockpair[1] = -1;
+               free(worker);
                LOG(ret ? PRINT_ERR : PRINT_DBG, "run_as worker exiting (ret = %d)", ret);
                exit(ret ? EXIT_FAILURE : EXIT_SUCCESS);
        } else {
This page took 0.025246 seconds and 4 git commands to generate.