summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-05-09 13:15:14 +0200
committerMark Wielaard <mark@klomp.org>2019-05-14 20:47:28 +0200
commit7d029dc4585f84937a9386dc6f7ce82fbe2e1e21 (patch)
tree56fd52e27aed7f14d32fb15d0d4ce5c603db6236
parentb5e8a481d4c9f9cdb26513784c09c57797fa2f46 (diff)
readelf: Clean up section lists after usage.
Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--src/ChangeLog5
-rw-r--r--src/readelf.c14
2 files changed, 19 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ae137932..0c817f41 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-09 Mark Wielaard <mark@klomp.org>
+
+ * readelf.c (cleanup_list): New function.
+ (main): Call cleanup_list for dump_data_sections and string_sections.
+
2019-04-28 Mark Wielaard <mark@klomp.org>
* unstrip.c (add_new_section_symbols): Call ELF_CHECK after
diff --git a/src/readelf.c b/src/readelf.c
index c346e1f8..4c20c38e 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -312,6 +312,17 @@ static void dump_archive_index (Elf *, const char *);
static char *yes_str;
static char *no_str;
+static void
+cleanup_list (struct section_argument *list)
+{
+ while (list != NULL)
+ {
+ struct section_argument *a = list;
+ list = a->next;
+ free (a);
+ }
+}
+
int
main (int argc, char *argv[])
{
@@ -353,6 +364,9 @@ main (int argc, char *argv[])
}
while (++remaining < argc);
+ cleanup_list (dump_data_sections);
+ cleanup_list (string_sections);
+
return error_message_count != 0;
}