From: Jérémie Galarneau Date: Thu, 11 May 2017 20:16:12 +0000 (-0400) Subject: Fix: leak of deserialized trigger sent from client X-Git-Tag: v2.10.0-rc2~62 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=090c29826feebfa8d904acd8a2a9e35a4ef93fce;p=lttng-tools.git Fix: leak of deserialized trigger sent from client 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 --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index f3ff25642..c4e4ccfbe 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -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; }