Fix: data leak in error path of cmd_register_consumer()
[lttng-tools.git] / 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.025473 seconds and 4 git commands to generate.