]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Don't leak fake_loc_cu.
authorMark Wielaard <mjw@redhat.com>
Tue, 1 Dec 2015 14:21:55 +0000 (15:21 +0100)
committerMark Wielaard <mjw@redhat.com>
Sat, 2 Jan 2016 19:37:44 +0000 (20:37 +0100)
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
libdw/dwarf_end.c

index d0f1de2137b386dfe9c05e80832e220c5b3c79f9..b176ade6f4d3d275ce34a09c7382072314f58baf 100644 (file)
@@ -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
index 32b551dfefe41874d19d3e1580bc8a16048b1928..2108063d224ae5ed4314a64922969e8fa051ebcc 100644 (file)
@@ -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);