aboutsummaryrefslogtreecommitdiff
path: root/binutils/arsup.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-01-31 12:39:29 +1030
committerAlan Modra <amodra@gmail.com>2023-01-31 15:18:04 +1030
commit6296342ec4473352483eaa82f0553d4a209319a1 (patch)
tree48b567404ffd8fb9fea9dbd24fed714ddb004d1b /binutils/arsup.c
parent9884676d9da9c691ba0d223836b5bf70740ee7e3 (diff)
downloadgdb-6296342ec4473352483eaa82f0553d4a209319a1.zip
gdb-6296342ec4473352483eaa82f0553d4a209319a1.tar.gz
gdb-6296342ec4473352483eaa82f0553d4a209319a1.tar.bz2
PR 30060, ASAN error in bfd_cache_close
After bfd_close nothing should access bfd memory. Now that bfd_close always tidies up even after an error, attempting to tidy the cached bfd list by calling bfd_cache_close is wrong and not needed. PR 30060 * ar.c (remove_output): Don't call bfd_cache_close. (output_bfd): Delete. * arsup.c (ar_end): Call bfd_close_all_done, not bfd_cache_close.
Diffstat (limited to 'binutils/arsup.c')
-rw-r--r--binutils/arsup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/binutils/arsup.c b/binutils/arsup.c
index 8ffb5f3..744a8d4 100644
--- a/binutils/arsup.c
+++ b/binutils/arsup.c
@@ -469,8 +469,9 @@ ar_end (void)
{
if (obfd)
{
- bfd_cache_close (obfd);
- unlink (bfd_get_filename (obfd));
+ const char *filename = bfd_get_filename (obfd);
+ bfd_close_all_done (obfd);
+ unlink (filename);
}
}