Fix: leak of deserialized trigger sent from client
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 11 May 2017 20:16:12 +0000 (16:16 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 15 May 2017 20:29:54 +0000 (16:29 -0400)
Deserialized triggers may be leaked on error when
registered or unregistered by the session daemon.

Reported-by: Coverity Scan
CID 1374801 (#1 of 1): Resource leak (RESOURCE_LEAK)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c

index f3ff25642e701a0f83e78bbfd02144c1a118dfdb..c4e4ccfbe5e0098c0d7e6a9da50e56b5a9b4795f 100644 (file)
@@ -3587,7 +3587,10 @@ int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
 
        ret = notification_thread_command_register_trigger(notification_thread,
                        trigger);
+       /* Ownership of trigger was transferred. */
+       trigger = NULL;
 end:
+       lttng_trigger_destroy(trigger);
        lttng_dynamic_buffer_reset(&trigger_buffer);
        return ret;
 }
@@ -3630,6 +3633,7 @@ int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
        ret = notification_thread_command_unregister_trigger(notification_thread,
                        trigger);
 end:
+       lttng_trigger_destroy(trigger);
        lttng_dynamic_buffer_reset(&trigger_buffer);
        return ret;
 }
This page took 0.02899 seconds and 4 git commands to generate.