Fix: data leak in error path of cmd_register_consumer()
authorDavid Goulet <dgoulet@efficios.com>
Tue, 14 May 2013 16:07:00 +0000 (12:07 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 14 May 2013 16:08:13 +0000 (12:08 -0400)
Issue 1019923 of coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/cmd.c

index 528665a141680d70d94bb979f5c76583bf454790..4eacb3c890ff27f33d5a985b868a68dce7d65abc 100644 (file)
@@ -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;
 }
 
This page took 0.028823 seconds and 4 git commands to generate.