Commit 53a52133 by Tom de Vries Committed by Tom de Vries

[libbacktrace] Fix memory leak in build_address_map

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.

2018-12-28  Tom de Vries  <tdevries@suse.de>

	* dwarf.c (build_address_map): Free addrs vector upon failure.

From-SVN: r267442
parent f1430309
2018-12-28 Tom de Vries <tdevries@suse.de>
* dwarf.c (build_address_map): Free addrs vector upon failure.
2018-12-14 Tom de Vries <tdevries@suse.de> 2018-12-14 Tom de Vries <tdevries@suse.de>
PR testsuite/88491 PR testsuite/88491
......
...@@ -1552,6 +1552,11 @@ build_address_map (struct backtrace_state *state, uintptr_t base_address, ...@@ -1552,6 +1552,11 @@ build_address_map (struct backtrace_state *state, uintptr_t base_address,
fail: fail:
free_abbrevs (state, &abbrevs, error_callback, data); free_abbrevs (state, &abbrevs, error_callback, data);
free_unit_addrs_vector (state, addrs, 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; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment