aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2009-08-16 17:32:35 +0000
committerDoug Evans <dje@google.com>2009-08-16 17:32:35 +0000
commit440ae135a822be30029115ff739e1d0e16a07858 (patch)
treecdc0f6d439043702947296f1d7a114a688fbca9a /bfd/opncls.c
parentca892441083947f02cbf7559893732712e77e0eb (diff)
downloadgdb-440ae135a822be30029115ff739e1d0e16a07858.zip
gdb-440ae135a822be30029115ff739e1d0e16a07858.tar.gz
gdb-440ae135a822be30029115ff739e1d0e16a07858.tar.bz2
* opncls.c (bfd_close): Until BFD_IN_MEMORY has an iovec,
at least don't leak memory.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 6a4f319..7992030 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -703,12 +703,18 @@ bfd_close (bfd *abfd)
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
return FALSE;
- /* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io
- vector. */
- if (!(abfd->flags & BFD_IN_MEMORY))
- ret = abfd->iovec->bclose (abfd);
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ {
+ /* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io
+ vector.
+ Until that's done, at least don't leak memory. */
+ struct bfd_in_memory *bim = abfd->iostream;
+ free (bim->buffer);
+ free (bim);
+ ret = TRUE;
+ }
else
- ret = TRUE;
+ ret = abfd->iovec->bclose (abfd);
if (ret)
_maybe_make_executable (abfd);