]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Clean up section lists after usage.
authorMark Wielaard <mark@klomp.org>
Thu, 9 May 2019 11:15:14 +0000 (13:15 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 14 May 2019 18:47:28 +0000 (20:47 +0200)
Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/readelf.c

index ae1379327483e5b53a8728808139d11c5b98a2b2..0c817f41761b79b70efd881c8657f8bb371c35e7 100644 (file)
@@ -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
index c346e1f8a494596b10369b084093a3731f1adc40..4c20c38ec65212430f1aca5e775d966a67a1edfd 100644 (file)
@@ -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;
 }