Fix: sessiond: client: leak of trigger object on invalid client message
authorJérémie Galarneau <>
Wed, 10 Feb 2021 19:33:11 +0000 (14:33 -0500)
committerJérémie Galarneau <>
Wed, 10 Feb 2021 19:38:09 +0000 (14:38 -0500)
Coverity reports:
1445927 Resource leak
The system resource will not be reclaimed and reused, reducing the future availability of the resource.
In receive_lttng_trigger: Leak of memory or pointers to system resources (CWE-404)

lttng_trigger_create_from_payload() can return a trigger (positive
return value) that doesn't match the advertised trigger size. In that
case, a trigger reference was still returned and must be released.

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <>
Change-Id: I5afac029ddcf32dd0a01064c9dc688ed9208f278


index c0086953a8e06bb1bb4405e3f0b3ba0954a407b4..00b5ec7e4ab7bb4db6a67c0c32855d2e77236162 100644 (file)
@@ -705,7 +705,7 @@ static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx,
        ssize_t sock_recv_len;
        enum lttng_error_code ret_code;
        struct lttng_payload trigger_payload;
-       struct lttng_trigger *trigger;
+       struct lttng_trigger *trigger = NULL;
        trigger_len = (size_t) cmd_ctx->lsm.u.trigger.length;
@@ -755,6 +755,7 @@ static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx,
                                trigger_len) {
                        ERR("Invalid trigger received as part of command payload");
                        ret_code = LTTNG_ERR_INVALID_TRIGGER;
+                       lttng_trigger_put(trigger);
                        goto end;
This page took 0.025594 seconds and 4 git commands to generate.