1
0
Fork 0
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:
Matt Fischer 2013-05-14 17:39:24 -05:00 committed by Arun Sharma
parent d41a453bbf
commit 3b8254d3b9

View file

@ -462,7 +462,7 @@ put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
{
if (c->pi_is_dynamic)
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);
pi->unwind_info = NULL;