Fix: Memory leak on run_as worker restart error path
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 7 Sep 2018 14:40:04 +0000 (10:40 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 7 Sep 2018 14:47:38 +0000 (10:47 -0400)
Reported-by: Coverity (1395614) Resource leak
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/runas.c

index c81652e9f4b4f3a09ca1747c0b030aa9d1e13c42..00c729fda3555b6414d5afca52b0d7f840739910 100644 (file)
@@ -877,7 +877,7 @@ int run_as_create_worker_no_lock(const char *procname)
        worker->procname = strdup(procname);
        if (!worker->procname) {
                ret = -ENOMEM;
-               goto end;
+               goto error_procname_alloc;
        }
        /* Create unix socket. */
        if (lttcomm_create_anon_unix_socketpair(worker->sockpair) < 0) {
@@ -960,6 +960,8 @@ error_fork:
                worker->sockpair[i] = -1;
        }
 error_sock:
+       free(worker->procname);
+error_procname_alloc:
        free(worker);
        return ret;
 }
This page took 0.026894 seconds and 4 git commands to generate.