From: Jonathan Rajotte Date: Tue, 1 Mar 2022 15:35:44 +0000 (-0500) Subject: Fix: sessiond: `break` used instead of `goto` X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=9402f1669d8035e4c5618652b92a3d29defbcd70;p=deliverable%2Flttng-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.cpp b/src/bin/lttng-sessiond/cmd.cpp index 2682629bb..e16f93f71 100644 --- a/src/bin/lttng-sessiond/cmd.cpp +++ b/src/bin/lttng-sessiond/cmd.cpp @@ -3765,8 +3765,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 *) @@ -3777,7 +3777,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; @@ -3790,8 +3790,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++;