Fix: flt.lttng-utils.debug-info: memory leak bt_dwarf_die struct
[babeltrace.git] / plugins / lttng-utils / debug-info / bin-info.c
index 6dfbc6a439750560e396f6cd5bb9dde3827a19e5..7451993d05c8e3a3a9b50b9eb20b2b537d90e0b4 100644 (file)
@@ -1396,7 +1396,7 @@ int bin_info_lookup_cu_src_loc_no_inl(struct bt_dwarf_cu *cu, uint64_t addr,
        const char *filename = NULL;
        Dwarf_Line *line = NULL;
        Dwarf_Addr line_addr;
-       int ret, line_no;
+       int ret = 0, line_no;
 
        if (!cu || !src_loc) {
                goto error;
@@ -1438,19 +1438,18 @@ int bin_info_lookup_cu_src_loc_no_inl(struct bt_dwarf_cu *cu, uint64_t addr,
                _src_loc->filename = g_strdup(filename);
        }
 
-       bt_dwarf_die_destroy(die);
-
        if (_src_loc) {
                *src_loc = _src_loc;
        }
 
-end:
-       return 0;
+       goto end;
 
 error:
        source_location_destroy(_src_loc);
+       ret = -1;
+end:
        bt_dwarf_die_destroy(die);
-       return -1;
+       return ret;
 }
 
 /**
This page took 0.024036 seconds and 4 git commands to generate.