When running the test_trace_collection_message_iterator.py test in a
build with -fsanitize=undefined, I see:
/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/visitor-generate-ir.cpp:1143:30: runtime error: member access within null pointer of type 'struct ctf_node'
This happens when `node_field_class_declarator` is nullptr. Avoid this
by using `node_field_class_declarator` once we know it's non-nullptr.
Change-Id: I585e5b17af7e1a16a217ef46c0a49fae901dcae8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/9513
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
/* Find the right nested declaration if not provided */
if (!nested_decl) {
/* Find the right nested declaration if not provided */
if (!nested_decl) {
- struct bt_list_head *pointers =
- &node_field_class_declarator->u.field_class_declarator.pointers;
-
- if (node_field_class_declarator && !bt_list_empty(pointers)) {
+ if (node_field_class_declarator &&
+ !bt_list_empty(&node_field_class_declarator->u.field_class_declarator.pointers)) {