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:
parent
8028a537dd
commit
f92ecb6127
1 changed files with 6 additions and 5 deletions
|
@ -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)
|
||||
{
|
||||
put_unwind_info (c, &c->pi);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = create_state_record_for (c, &sr, c->ip)) < 0)
|
||||
return ret;
|
||||
|
@ -864,6 +864,7 @@ dwarf_find_save_locs (struct dwarf_cursor *c)
|
|||
(ret = create_state_record_for (c, &sr, c->ip)) < 0)
|
||||
{
|
||||
put_rs_cache (c->as, cache, &saved_mask);
|
||||
put_unwind_info (c, &c->pi);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue