1 From f92ecb61273bf58f9372f96868a9b8fb4d920ad4 Mon Sep 17 00:00:00 2001
2 From: Arun Sharma <asharma@fb.com>
3 Date: Tue, 2 Apr 2013 21:17:18 -0700
4 Subject: [PATCH] dwarf: Fix memory leak
6 Need to clean up by calling put_unwind_info() on code paths where fetch_proc_info() fails.
8 Signed-off-by: Arun Sharma <asharma@fb.com>
10 src/dwarf/Gparser.c | 11 ++++++-----
11 1 files changed, 6 insertions(+), 5 deletions(-)
13 diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c
14 index 49c79db..0f9c221 100644
15 --- a/src/dwarf/Gparser.c
16 +++ b/src/dwarf/Gparser.c
17 @@ -460,9 +460,6 @@ parse_dynamic (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
19 put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
25 unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
26 else if (pi->unwind_info)
27 @@ -824,7 +821,10 @@ uncached_dwarf_find_save_locs (struct dwarf_cursor *c)
30 if ((ret = fetch_proc_info (c, c->ip, 1)) < 0)
33 + put_unwind_info (c, &c->pi);
37 if ((ret = create_state_record_for (c, &sr, c->ip)) < 0)
39 @@ -863,7 +863,8 @@ dwarf_find_save_locs (struct dwarf_cursor *c)
40 if ((ret = fetch_proc_info (c, c->ip, 1)) < 0 ||
41 (ret = create_state_record_for (c, &sr, c->ip)) < 0)
43 - put_rs_cache (c->as, cache, &saved_mask);
44 + put_rs_cache (c->as, cache, &saved_mask);
45 + put_unwind_info (c, &c->pi);