Fix: flt.utils.muxer: Explicit null dereferenced
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 9 Aug 2019 20:35:54 +0000 (16:35 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 10 Aug 2019 18:17:32 +0000 (14:17 -0400)
Fixes coverity #1404006

  ID 1404006 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
  18. var_deref_op: Dereferencing null pointer *muxer_upstream_msg_iter

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I055200226ab13653b219a084f38a2dd9bb16664b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1859
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/utils/muxer/muxer.c

index ecd5d8d92f059147f0bec1f01dceae1b6ed94b8a..f67955d1d94de57e385120b2df08b79b197950ee 100644 (file)
@@ -946,7 +946,13 @@ muxer_msg_iter_youngest_upstream_msg_iter(
                        goto end;
                }
 
-               if (msg_ts_ns < youngest_ts_ns) {
+               /*
+                * Update the current message iterator if it has not been set
+                * yet, or if its current message has a timestamp smaller than
+                * the previously selected youngest message.
+                */
+               if (G_UNLIKELY(*muxer_upstream_msg_iter == NULL) ||
+                               msg_ts_ns < youngest_ts_ns) {
                        *muxer_upstream_msg_iter =
                                cur_muxer_upstream_msg_iter;
                        youngest_ts_ns = msg_ts_ns;
This page took 0.025376 seconds and 4 git commands to generate.