Coverity report:
CID
1401218 (#1 of 1): Dereference after null check (FORWARD_NULL)
4. var_deref_op: Dereferencing null pointer bin.
Reported-by: Coverity (1401218) Dereference after null check
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I1821a4f2e39096cb3dca75033ab9ce25f4b63127
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2167
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
{
struct bt_fd_cache_handle *elf_handle = NULL;
Elf *elf_file = NULL;
+ int ret;
- if (!bin) {
- goto error;
- }
+ BT_ASSERT(bin);
elf_handle = bt_fd_cache_get_handle(bin->fd_cache, bin->elf_path);
if (!elf_handle) {
goto error;
}
- return 0;
+
+ ret = 0;
+ goto end;
error:
bt_fd_cache_put_handle(bin->fd_cache, elf_handle);
elf_end(elf_file);
- return -1;
+ ret = -1;
+
+end:
+ return ret;
}
/**