mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-22 07:37:38 +01:00
Fix unwind info freeing code in DWARF parser
The DWARF code allocates its unwind_info objects out of a memory pool. The code which frees the object therefore calls the mempool freeing code. However, there are cases where the free code will be run with an unwind_info that was allocated through a different mechanism (e.g. an ARM exidx table entry). In these cases, the object should not be freed through the mempool code. To correct this, a check was added to ensure that the unwind_info is of the appropriate type before passing the object along to the mempool to be freed.
This commit is contained in:
parent
d41a453bbf
commit
3b8254d3b9
1 changed files with 1 additions and 1 deletions
|
@ -462,7 +462,7 @@ put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
|
||||||
{
|
{
|
||||||
if (c->pi_is_dynamic)
|
if (c->pi_is_dynamic)
|
||||||
unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
|
unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
|
||||||
else if (pi->unwind_info)
|
else if (pi->unwind_info && pi->format == UNW_INFO_FORMAT_TABLE)
|
||||||
{
|
{
|
||||||
mempool_free (&dwarf_cie_info_pool, pi->unwind_info);
|
mempool_free (&dwarf_cie_info_pool, pi->unwind_info);
|
||||||
pi->unwind_info = NULL;
|
pi->unwind_info = NULL;
|
||||||
|
|
Loading…
Reference in a new issue