From: David Goulet Date: Tue, 14 May 2013 16:07:00 +0000 (-0400) Subject: Fix: data leak in error path of cmd_register_consumer() X-Git-Tag: v2.2.0-rc3~77 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dd81b457300c29274b181b6f9cbd6d3f45610cd9;p=lttng-tools.git Fix: data leak in error path of cmd_register_consumer() Issue 1019923 of coverity scan. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 528665a14..4eacb3c89 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1831,7 +1831,7 @@ int cmd_register_consumer(struct ltt_session *session, int domain, const char *sock_path, struct consumer_data *cdata) { int ret, sock; - struct consumer_socket *socket; + struct consumer_socket *socket = NULL; assert(session); assert(cdata); @@ -1891,9 +1891,12 @@ int cmd_register_consumer(struct ltt_session *session, int domain, goto error; } - ret = LTTNG_OK; + return LTTNG_OK; error: + if (socket) { + consumer_destroy_socket(socket); + } return ret; }