From 473e4d2acf7f005953af3893bb318222b728412e Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 14 Apr 2020 21:23:52 -0400 Subject: [PATCH] Fix: sink.text.pretty: assign status at the end of pretty_consume The compiler on SLES 12 reports: pretty.c:200:2: warning: 'status' may be used uninitialized in this function [-Wmaybe-uninitialized] return status; ^ We are indeed missing an assignment of status at the end, if everything went well. In practice, status has the right value (_OK) from the last call of handle_message. But if, for some reason, bt_message_iterator_next returns OK with 0 messages, then it would stay unset. So assigning it explicitly at the end doesn't hurt. Change-Id: Ic3bf018388f006c919173f9e8942a8ab2384c0f1 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/3427 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/plugins/text/pretty/pretty.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/text/pretty/pretty.c b/src/plugins/text/pretty/pretty.c index a68321a8..a3aa3f81 100644 --- a/src/plugins/text/pretty/pretty.c +++ b/src/plugins/text/pretty/pretty.c @@ -192,6 +192,8 @@ bt_component_class_sink_consume_method_status pretty_consume( bt_message_put_ref(msgs[i]); } + status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK; + end: for (; i < count; i++) { bt_message_put_ref(msgs[i]); -- 2.34.1