summaryrefslogtreecommitdiffstats
path: root/libdwfl
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-06-06 22:49:34 +0200
committerMark Wielaard <[email protected]>2015-06-09 22:53:05 +0200
commit93d895970ddd4cd9c0392ab16bad94def1a8ff70 (patch)
tree3857d08b060008e757aa7bad0d43c0ff6844652c /libdwfl
parentede1d9d8aa4b04810e1ee04fcec9386e63f48d77 (diff)
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 <[email protected]>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog4
-rw-r--r--libdwfl/derelocate.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0daf893c..956ac9ff 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-06 Mark Wielaard <[email protected]>
+
+ * derelocate.c (cache_sections): Free sortrefs.
+
2015-06-05 Mark Wielaard <[email protected]>
* dwfl_segment_report_module.c (dwfl_segment_report_module):
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index 48f81935..439a24e3 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);