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>
Thu, 6 Dec 2018 21:34:34 +0000 (16:34 -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 00c729fda3555b6414d5afca52b0d7f840739910..4fc229b0d0317452df0b3db08c78ab4c998a97d3 100644 (file)
@@ -921,6 +921,8 @@ int run_as_create_worker_no_lock(const char *procname)
                        ret = -1;
                }
                worker->sockpair[1] = -1;
+               free(worker->procname);
+               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.027472 seconds and 4 git commands to generate.