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:26 +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 f753d2454de44c6b43815aa289c652e0d62f88c2..9e3b5ec3395d823d301b5ee1b8bed7f83f20bfe6 100644 (file)
@@ -656,6 +656,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.026181 seconds and 4 git commands to generate.