1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-25 08:37:38 +01:00

dwarf: Fix memory leak

Need to clean up by calling put_unwind_info() on code paths where fetch_proc_info() fails.

Signed-off-by: Arun Sharma <asharma@fb.com>
This commit is contained in:
Arun Sharma 2013-04-02 21:17:18 -07:00
parent 8028a537dd
commit f92ecb6127

View file

@ -460,9 +460,6 @@ parse_dynamic (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
static inline void
put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
{
if (!c->pi_valid)
return;
if (c->pi_is_dynamic)
unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
else if (pi->unwind_info)
@ -824,7 +821,10 @@ uncached_dwarf_find_save_locs (struct dwarf_cursor *c)
int ret;
if ((ret = fetch_proc_info (c, c->ip, 1)) < 0)
return ret;
{
put_unwind_info (c, &c->pi);
return ret;
}
if ((ret = create_state_record_for (c, &sr, c->ip)) < 0)
return ret;
@ -863,7 +863,8 @@ dwarf_find_save_locs (struct dwarf_cursor *c)
if ((ret = fetch_proc_info (c, c->ip, 1)) < 0 ||
(ret = create_state_record_for (c, &sr, c->ip)) < 0)
{
put_rs_cache (c->as, cache, &saved_mask);
put_rs_cache (c->as, cache, &saved_mask);
put_unwind_info (c, &c->pi);
return ret;
}