]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Fix various frame related memory leaks.
authorMark Wielaard <mjw@redhat.com>
Sat, 14 Dec 2013 14:02:56 +0000 (15:02 +0100)
committerMark Wielaard <mjw@redhat.com>
Mon, 16 Dec 2013 08:03:22 +0000 (09:03 +0100)
The result of dwarf_cfi_addrframe should have been freed when done.
Dwfl_Module cached the reloc_info and the eh_cfi it which also should
have been released when disposing of the module.

Reported-by: Masatake YAMATO <yamato@redhat.com>
Tested-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_module.c
libdwfl/frame_unwind.c

index ff38108e6bc1d174d8ff68760b302ff9d44fdaf4..a9238d80f80e5ea5039f1def030509eb938ce3dd 100644 (file)
@@ -1,3 +1,10 @@
+2013-12-14  Mark Wielaard  <mjw@redhat.com>
+
+       * dwfl_module.c (__libdwfl_module_free): Free mod->reloc_info if
+       allocated. Call dwarf_cfi_end on mod->eh_cfi if necessary.
+       * frame_unwind.c (handle_cfi): Free frame result from
+       dwarf_cfi_addrframe when done.
+
 2013-12-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        unwinder: ppc and ppc64
index f914b3a392e692e01ca15d0d466cc31e664c58ae..bb167ab265d91d74f4cb73e8e9ebf4bf28b702a8 100644 (file)
@@ -84,6 +84,12 @@ __libdwfl_module_free (Dwfl_Module *mod)
   if (mod->build_id_bits != NULL)
     free (mod->build_id_bits);
 
+  if (mod->reloc_info != NULL)
+    free (mod->reloc_info);
+
+  if (mod->eh_cfi != NULL)
+    dwarf_cfi_end (mod->eh_cfi);
+
   free (mod->name);
   free (mod);
 }
index 2973f95591c14f861fff5ae6005762a20bdd44c3..630efcb6fa00e1d7dd74737b35a9cbab35790e8b 100644 (file)
@@ -580,6 +580,7 @@ handle_cfi (Dwfl_Frame *state, Dwarf_Addr pc, Dwarf_CFI *cfi, Dwarf_Addr bias)
       else
        unwound->pc_state = DWFL_FRAME_STATE_PC_SET;
     }
+  free (frame);
 }
 
 void