]>
git.efficios.com Git - babeltrace.git/commit
debug-info: fix one -Wnull-dereference warning
When building with gcc at -O2, I get:
CC debug-info.lo
/home/simark/src/babeltrace/src/plugins/lttng-utils/debug-info/debug-info.c: In function ‘debug_info_msg_iter_next’:
/home/simark/src/babeltrace/src/plugins/lttng-utils/debug-info/debug-info.c:181:19: error: potential null pointer dereference [-Werror=null-dereference]
181 | bt_logging_level log_level = bin->log_level;
| ^~~~~~~~~
Putting a BT_ASSERT(bin) convinces gcc that bin won't be NULL, and if it
ever happens to be NULL (because we mess up), the crash will be
smoother.
This is the last instance of the -Wnull-dereference, so we can remove
-Wno-null-dereference from configure.ac.
Change-Id: I8bf5c6a0cf231e8516ece14be7b3fcf6f5eaa2ad
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2270
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
This page took 0.02851 seconds and 4 git commands to generate.