Hi, While upon failure in build_address_map we call free_unit_addrs_vector, this does not actually free the addrs vector, but merely the abbrevs of the units pointed at by the elements of the addrs vector.
Fix this by adding code to build_address_map to make sure that the addrs vector is freed upon failure. Bootstrapped and reg-tested on x86_64. OK for trunk? Thanks, - Tom [libbacktrace] Fix memory leak in build_address_map 2018-11-28 Tom de Vries <tdevr...@suse.de> * dwarf.c (build_address_map): Free addrs vector upon failure. --- libbacktrace/dwarf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c index 13d0aa4bcd8..b818911f5b4 100644 --- a/libbacktrace/dwarf.c +++ b/libbacktrace/dwarf.c @@ -1552,6 +1552,11 @@ build_address_map (struct backtrace_state *state, uintptr_t base_address, fail: free_abbrevs (state, &abbrevs, error_callback, data); free_unit_addrs_vector (state, addrs, error_callback, data); + if (addrs->count > 0) + { + backtrace_vector_free (state, &addrs->vec, error_callback, data); + addrs->count = 0; + } return 0; }