Fix: flt.lttng-utils.debug-info: Dereference after null check
[babeltrace.git] / src / plugins / lttng-utils / debug-info / bin-info.c
index 31c347ea7088348b32af3efed14d07b12d877f44..080472a983f4274f29677ad9e5773ea06fd9efc2 100644 (file)
@@ -163,10 +163,9 @@ int bin_info_set_elf_file(struct bin_info *bin)
 {
        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) {
@@ -189,12 +188,17 @@ int bin_info_set_elf_file(struct bin_info *bin)
                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;
 }
 
 /**
This page took 0.035068 seconds and 4 git commands to generate.