1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-14 04:18:11 +01:00

dwarf:Drop dwarf_create_state_record.

In dwarf_make_proc_info, fix a leak in the case that create_state_record fails.
This commit is contained in:
Doug Moore 2017-04-27 17:39:37 -05:00 committed by Dave Watson
parent 3775cdd997
commit 59ecb24ca2
2 changed files with 9 additions and 19 deletions

View file

@ -398,7 +398,6 @@ struct dwarf_callback_data
#define dwarf_extract_proc_info_from_fde \
UNW_OBJ (dwarf_extract_proc_info_from_fde)
#define dwarf_find_save_locs UNW_OBJ (dwarf_find_save_locs)
#define dwarf_create_state_record UNW_OBJ (dwarf_create_state_record)
#define dwarf_make_proc_info UNW_OBJ (dwarf_make_proc_info)
#define dwarf_read_encoded_pointer UNW_OBJ (dwarf_read_encoded_pointer)
#define dwarf_step UNW_OBJ (dwarf_step)
@ -441,8 +440,6 @@ extern int dwarf_extract_proc_info_from_fde (unw_addr_space_t as,
int is_debug_frame,
void *arg);
extern int dwarf_find_save_locs (struct dwarf_cursor *c);
extern int dwarf_create_state_record (struct dwarf_cursor *c,
dwarf_state_record_t *sr);
extern int dwarf_make_proc_info (struct dwarf_cursor *c);
extern int dwarf_read_encoded_pointer (unw_addr_space_t as,
unw_accessors_t *a,

View file

@ -925,14 +925,6 @@ dwarf_find_save_locs (struct dwarf_cursor *c)
return 0;
}
/* The proc-info must be valid for IP before this routine can be
called. */
HIDDEN int
dwarf_create_state_record (struct dwarf_cursor *c, dwarf_state_record_t *sr)
{
return create_state_record_for (c, sr, c->ip);
}
HIDDEN int
dwarf_make_proc_info (struct dwarf_cursor *c)
{
@ -940,18 +932,19 @@ dwarf_make_proc_info (struct dwarf_cursor *c)
if (c->as->caching_policy == UNW_CACHE_NONE
|| get_cached_proc_info (c) < 0)
#endif
/* Need to check if current frame contains
args_size, and set cursor appropriately. Only
needed for unw_resume */
dwarf_state_record_t sr;
int ret;
/* Lookup it up the slow way... */
if ((ret = fetch_proc_info (c, c->ip, 0)) < 0)
return ret;
/* Also need to check if current frame contains
args_size, and set cursor appropriatly. Only
needed for unw_resume */
if ((ret = dwarf_create_state_record (c, &sr)) < 0)
return ret;
ret = fetch_proc_info (c, c->ip, 0);
if (ret >= 0)
ret = create_state_record_for (c, &sr, c->ip);
put_unwind_info (c, &c->pi);
if (ret < 0)
return ret;
c->args_size = sr.args_size;
return 0;