From: Jonathan Rajotte Date: Tue, 1 Mar 2022 15:31:33 +0000 (-0500) Subject: Fix: sessiond: lttng_channel object is not reclaimed X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88b02a8e7cbdbc728cc681cd07bbe0c738964717;p=lttng-tools.git Fix: sessiond: lttng_channel object is not reclaimed The reclaim is also missing on the error path. Reported by Coverity: CID 1475807: Resource leak (RESOURCE_LEAK) Variable channel going out of scope leaks the storage it points to. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I9ae59900f6bc33282b8b8a65b834a718428a7f50 --- diff --git a/src/bin/lttng-sessiond/cmd.cpp b/src/bin/lttng-sessiond/cmd.cpp index 659e389b2..2682629bb 100644 --- a/src/bin/lttng-sessiond/cmd.cpp +++ b/src/bin/lttng-sessiond/cmd.cpp @@ -3785,6 +3785,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain, ret = lttng_channel_serialize( channel, &payload->buffer); + lttng_channel_destroy(channel); if (ret) { ERR("Failed to serialize lttng_channel: channel name = '%s'", channel->name);