From: Mark Wielaard Date: Sat, 6 Jun 2015 20:49:34 +0000 (+0200) Subject: libdwfl: Fix memory leak in cache_sections. X-Git-Tag: elfutils-0.162~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93d895970ddd4cd9c0392ab16bad94def1a8ff70;p=thirdparty%2Felfutils.git libdwfl: Fix memory leak in cache_sections. commit be1778 libdwfl: Fix possible unbounded stack usage in cache_sections. introduced a memory leak. The refs pointers were copied to the sortrefs array but never freed. Only the array was freed. Also free the elements. Signed-off-by: Mark Wielaard --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 0daf893c2..956ac9ffe 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2015-06-06 Mark Wielaard + + * derelocate.c (cache_sections): Free sortrefs. + 2015-06-05 Mark Wielaard * dwfl_segment_report_module.c (dwfl_segment_report_module): diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c index 48f819353..439a24e3b 100644 --- a/libdwfl/derelocate.c +++ b/libdwfl/derelocate.c @@ -177,6 +177,7 @@ cache_sections (Dwfl_Module *mod) mod->reloc_info->refs[i].relocs = sortrefs[i]->relocs; mod->reloc_info->refs[i].start = sortrefs[i]->start; mod->reloc_info->refs[i].end = sortrefs[i]->end; + free (sortrefs[i]); } free (sortrefs);