From: Francis Deslauriers Date: Fri, 7 Sep 2018 14:40:04 +0000 (-0400) Subject: Fix: Memory leak on run_as worker restart error path X-Git-Tag: v2.12.0-rc1~816 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8c96eded789ec41a07bacd5777aa6fdb8e85c5e1;p=lttng-tools.git Fix: Memory leak on run_as worker restart error path Reported-by: Coverity (1395614) Resource leak Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/runas.c b/src/common/runas.c index c81652e9f..00c729fda 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -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; }