From: Francis Deslauriers Date: Thu, 30 May 2019 14:23:02 +0000 (-0400) Subject: Fix: flt.lttng-utils.debug-info: memory leak bt_dwarf_die struct X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=f06a3e4792a03eeb61f23640229c77945ca5eaf3 Fix: flt.lttng-utils.debug-info: memory leak bt_dwarf_die struct Reported-by: Address Sanitizer - Memory Leak Signed-off-by: Francis Deslauriers Change-Id: I4591884681920fc6068572dcdb1923f82c9f81d6 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1351 Reviewed-by: Philippe Proulx Tested-by: jenkins --- diff --git a/plugins/lttng-utils/debug-info/bin-info.c b/plugins/lttng-utils/debug-info/bin-info.c index 6dfbc6a4..7451993d 100644 --- a/plugins/lttng-utils/debug-info/bin-info.c +++ b/plugins/lttng-utils/debug-info/bin-info.c @@ -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; } /**