From: Mark Wielaard Date: Tue, 1 Dec 2015 14:21:55 +0000 (+0100) Subject: libdw: Don't leak fake_loc_cu. X-Git-Tag: elfutils-0.165~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db30f8b21993c09339c5bced7b0827eedf8d4fef;p=thirdparty%2Felfutils.git 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 --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index d0f1de213..b176ade6f 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2015-12-01 Mark Wielaard + + * dwarf_end.c (dwarf_end): Call cu_free on fake_loc_cu if it exists. + 2015-10-14 Chih-Hung Hsieh * dwarf_entry_breakpoints.c (dwarf_entry_breakpoints): Move recursive diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index 32b551dfe..2108063d2 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);