aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 47fef70..2ceb77e 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -647,6 +647,8 @@ bfd_boolean
bfd_close (bfd *abfd)
{
bfd_boolean ret;
+ bfd *nbfd;
+ bfd *next;
if (bfd_write_p (abfd))
{
@@ -654,6 +656,13 @@ bfd_close (bfd *abfd)
return FALSE;
}
+ /* Close nested archives (if this bfd is a thin archive). */
+ for (nbfd = abfd->nested_archives; nbfd; nbfd = next)
+ {
+ next = nbfd->archive_next;
+ bfd_close (nbfd);
+ }
+
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
return FALSE;