This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] libdw: Don't leak fake_loc_cu.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Tue, 01 Dec 2015 15:40:01 +0100
- Subject: Re: [PATCH] libdw: Don't leak fake_loc_cu.
On Tue, 2015-12-01 at 15:34 +0100, Mark Wielaard wrote:
> 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.
Sorry. That missed the actual code change.
Here it is again, but now with the actual code change attached.
From 290a64f6f09be34f067d4886ea7fe0296d822249 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Tue, 1 Dec 2015 15:21:55 +0100
Subject: [PATCH] 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>
---
libdw/ChangeLog | 4 ++++
libdw/dwarf_end.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 4d02449..81eeae6 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-19 Mark Wielaard <mjw@redhat.com>
* frame-cache.c (__libdw_destroy_frame_cache): Call ebl_closebackend
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 32b551d..2108063 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);
--
2.5.0