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>
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;