From c449a5c3412c92591d6eead8b25e1ea239427801 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Mon, 16 Sep 2019 10:59:37 -0400 Subject: [PATCH] Fix: flt.lttng-utils.debug-info: bin-info.c: Dereferencing null pointer Coverity reported the following: CID 1401211 (#1 of 1): Dereference after null check (FORWARD_NULL)4. var_deref_op: Dereferencing null pointer bin. Reported-by: Coverity - 1401211 Dereference after null check (FORWARD_NULL) Signed-off-by: Francis Deslauriers Change-Id: I66c3dc42305b1c14a5567141274249c6e6b10082 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2050 Tested-by: jenkins Reviewed-by: Simon Marchi --- src/plugins/lttng-utils/debug-info/bin-info.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/lttng-utils/debug-info/bin-info.c b/src/plugins/lttng-utils/debug-info/bin-info.c index 149236e8..31c347ea 100644 --- a/src/plugins/lttng-utils/debug-info/bin-info.c +++ b/src/plugins/lttng-utils/debug-info/bin-info.c @@ -488,7 +488,9 @@ int bin_info_set_dwarf_info_from_path(struct bin_info *bin, char *path) return 0; error: - bt_fd_cache_put_handle(bin->fd_cache, dwarf_handle); + if (bin) { + bt_fd_cache_put_handle(bin->fd_cache, dwarf_handle); + } dwarf_end(dwarf_info); g_free(dwarf_info); free(cu); -- 2.34.1