[PATCH] libdwfl: Fix memory leak in cache_sections.
Mark Wielaard
mjw at redhat.com
Sat Jun 6 20:56:16 UTC 2015
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 <mjw at redhat.com>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/derelocate.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0daf893..956ac9f 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-06 Mark Wielaard <mjw at redhat.com>
+
+ * derelocate.c (cache_sections): Free sortrefs.
+
2015-06-05 Mark Wielaard <mjw at redhat.com>
* dwfl_segment_report_module.c (dwfl_segment_report_module):
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index 48f8193..439a24e 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);
--
2.1.0
More information about the elfutils-devel
mailing list