1 From 3b8254d3b911193d1270bed6e941f56479ef5a85 Mon Sep 17 00:00:00 2001
2 From: Matt Fischer <matt.fischer@garmin.com>
3 Date: Tue, 14 May 2013 17:39:24 -0500
4 Subject: [PATCH] Fix unwind info freeing code in DWARF parser
6 The DWARF code allocates its unwind_info objects out of a
7 memory pool. The code which frees the object therefore calls
8 the mempool freeing code. However, there are cases where the
9 free code will be run with an unwind_info that was allocated
10 through a different mechanism (e.g. an ARM exidx table entry).
11 In these cases, the object should not be freed through the
14 To correct this, a check was added to ensure that the unwind_info
15 is of the appropriate type before passing the object along to the
18 src/dwarf/Gparser.c | 2 +-
19 1 files changed, 1 insertions(+), 1 deletions(-)
21 diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c
22 index 0f9c221..b251e31 100644
23 --- a/src/dwarf/Gparser.c
24 +++ b/src/dwarf/Gparser.c
25 @@ -462,7 +462,7 @@ put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
28 unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
29 - else if (pi->unwind_info)
30 + else if (pi->unwind_info && pi->format == UNW_INFO_FORMAT_TABLE)
32 mempool_free (&dwarf_cie_info_pool, pi->unwind_info);
33 pi->unwind_info = NULL;