If the null check at line 148 is true, the `counter` pointer might be
used will be used while being NULL by the
`destroy_private_counter_data()` function.
scan-build report:
Access to field 'msg_iter' results in a dereference of a null pointer
(loaded from variable 'counter')
Reported-by: scan-build - Logic error Dereference of null pointer
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I50bb981433ef3f5083613b36bbef54743cddb4c2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1970
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
void destroy_private_counter_data(struct counter *counter)
{
- bt_self_component_port_input_message_iterator_put_ref(counter->msg_iter);
- g_free(counter);
+ if (counter) {
+ bt_self_component_port_input_message_iterator_put_ref(
+ counter->msg_iter);
+ g_free(counter);
+ }
}
BT_HIDDEN