From: Jonathan Rajotte Date: Tue, 1 Mar 2022 15:35:44 +0000 (-0500) Subject: Fix: sessiond: `break` used instead of `goto` X-Git-Tag: v2.13.5~29 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dd0998359fbd60a4321c8b218ca56db375344d6f;p=lttng-tools.git Fix: sessiond: `break` used instead of `goto` On error path, use `goto`. Reported by Coverity: CID 1475805: Unused value (UNUSED_VALUE) Assigning value LTTNG_ERR_UNK to ret_code here, but that stored value is overwritten before it can be used. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Ife3b5486b8463242dfecb61a3a9718e8eb7149b4 --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 3fa56a57e..9bdfab141 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -3766,8 +3766,8 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain, channel = trace_ust_channel_to_lttng_channel(uchan); if (!channel) { - ret = LTTNG_ERR_NOMEM; - break; + ret_code = LTTNG_ERR_NOMEM; + goto end; } extended = (struct lttng_channel_extended *) @@ -3778,7 +3778,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain, if (ret < 0) { lttng_channel_destroy(channel); ret_code = LTTNG_ERR_UNK; - break; + goto end; } extended->discarded_events = discarded_events; @@ -3791,8 +3791,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain, ERR("Failed to serialize lttng_channel: channel name = '%s'", channel->name); ret_code = LTTNG_ERR_UNK; - ret = -1; - break; + goto end; } i++;