Fix: sink.text.pretty: assign status at the end of pretty_consume
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 15 Apr 2020 01:23:52 +0000 (21:23 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 21 Apr 2020 19:09:38 +0000 (15:09 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3427
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/text/pretty/pretty.c

index a68321a841b7af5ebb94a0468391232638a775b6..a3aa3f812f8669865851176a235e5bac6d27d46d 100644 (file)
@@ -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]);
This page took 0.025407 seconds and 4 git commands to generate.