summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-12-01 15:21:55 +0100
committerMark Wielaard <mjw@redhat.com>2016-01-02 20:37:44 +0100
commitdb30f8b21993c09339c5bced7b0827eedf8d4fef (patch)
tree60cd58ccb79499eeb5c5fe54f14984448964581a
parent095f53490bcf684a834d835ee8118f1d8ea51698 (diff)
downloadelfutils-db30f8b21993c09339c5bced7b0827eedf8d4fef.tar.gz
libdw: Don't leak fake_loc_cu.
The fake_loc_cu is used when synthesizing attributes for Dwarf_Ops that came from a location list entry in dwarf_getlocation_attr. Make sure we remove the loc cache stored in it when disposing of the fake_loc_cu. Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/dwarf_end.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index d0f1de21..b176ade6 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2015-12-01 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_end.c (dwarf_end): Call cu_free on fake_loc_cu if it exists.
+
2015-10-14 Chih-Hung Hsieh <chh@google.com>
* dwarf_entry_breakpoints.c (dwarf_entry_breakpoints): Move recursive
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 32b551df..2108063d 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
@@ -117,7 +117,11 @@ dwarf_end (Dwarf *dwarf)
elf_end (dwarf->elf);
/* Free the fake location list CU. */
- free (dwarf->fake_loc_cu);
+ if (dwarf->fake_loc_cu != NULL)
+ {
+ cu_free (dwarf->fake_loc_cu);
+ free (dwarf->fake_loc_cu);
+ }
/* Free the context descriptor. */
free (dwarf);