]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Close ar members when they cannot be processed.
authorMark Wielaard <mark@klomp.org>
Fri, 18 Mar 2022 15:01:20 +0000 (16:01 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 18 Mar 2022 15:01:20 +0000 (16:01 +0100)
When reporting ar members they should be closed when they cannot
be processed. A comment in offline.c said that process_file called
elf_end if it returned NULL. But this is incorrect. And other places
that call process_file do call elf_end explicitly when it returns
NULL.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/ChangeLog
libdwfl/offline.c

index b2588b129e171fa1be8fb08c1df1913a3a19bc0e..182f4e34bee9fea9b7e099af4d826964569fcea2 100644 (file)
@@ -1,3 +1,8 @@
+2022-02-18  Mark Wielaard  <mark@klomp.org>
+
+       * offline.c (process_archive_member): Close member if process_file
+       failed.
+
 2022-01-03  Mark Wielaard  <mark@klomp.org>
 
        * link_map.c (dwfl_link_map_report): Only declare d32 and d64 before
index d8697cf28480269eddd53945d08a6ef76f6ae9ee..58ba4c3699b93c2faccf670fe4cfb82222eabe53 100644 (file)
@@ -1,5 +1,6 @@
 /* Recover relocatibility for addresses computed from debug information.
    Copyright (C) 2005-2009, 2012 Red Hat, Inc.
+   Copyright (C) 2022 Mark J. Wielaard <mark@klomp.org>
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -233,8 +234,11 @@ process_archive_member (Dwfl *dwfl, const char *name, const char *file_name,
   free (member_name);
   free (module_name);
 
-  if (*mod == NULL)            /* process_file called elf_end.  */
-    return ELF_C_NULL;
+  if (*mod == NULL)
+    {
+      elf_end (member);
+      return ELF_C_NULL;
+    }
 
   /* Advance the archive-reading offset for the next iteration.  */
   return elf_next (member);