mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
close last arfile before processing current arfile
This also reduces peak memory a little. * dlltool.c (identify_search_archive): Close last_arfile earlier. Report an error if bfd_openr_next_archived_file returns the same bfd. Localise variables. * nm.c (display_archive): Likewise. * objdump.c (display_any_bfd): Likewise. * size.c (display_archive): Likewise.
This commit is contained in:
@@ -368,16 +368,15 @@ display_bfd (bfd *abfd)
|
||||
static void
|
||||
display_archive (bfd *file)
|
||||
{
|
||||
bfd *arfile = (bfd *) NULL;
|
||||
bfd *last_arfile = (bfd *) NULL;
|
||||
|
||||
bfd *last_arfile = NULL;
|
||||
for (;;)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_error);
|
||||
|
||||
arfile = bfd_openr_next_archived_file (file, arfile);
|
||||
if (arfile == NULL)
|
||||
bfd *arfile = bfd_openr_next_archived_file (file, last_arfile);
|
||||
if (arfile == NULL
|
||||
|| arfile == last_arfile)
|
||||
{
|
||||
if (arfile != NULL)
|
||||
bfd_set_error (bfd_error_malformed_archive);
|
||||
if (bfd_get_error () != bfd_error_no_more_archived_files)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (file));
|
||||
@@ -386,17 +385,10 @@ display_archive (bfd *file)
|
||||
break;
|
||||
}
|
||||
|
||||
display_bfd (arfile);
|
||||
|
||||
if (last_arfile != NULL)
|
||||
{
|
||||
bfd_close (last_arfile);
|
||||
|
||||
/* PR 17512: file: a244edbc. */
|
||||
if (last_arfile == arfile)
|
||||
return;
|
||||
}
|
||||
bfd_close (last_arfile);
|
||||
|
||||
display_bfd (arfile);
|
||||
last_arfile = arfile;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user