aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-10-16 07:14:43 +0000
committerAlan Modra <amodra@gmail.com>2009-10-16 07:14:43 +0000
commit493152cb4f287f9de3f03743349e911df9448e60 (patch)
tree73825fdd6b8ba7e0238b5957c702b55308e4ffc6 /bfd/opncls.c
parent12edd763cc3b83a257eb3173caca075f027e9afa (diff)
downloadgdb-493152cb4f287f9de3f03743349e911df9448e60.zip
gdb-493152cb4f287f9de3f03743349e911df9448e60.tar.gz
gdb-493152cb4f287f9de3f03743349e911df9448e60.tar.bz2
PR binutils/10785
* coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Don't bfd_alloc bim and bim->buffer. bfd_malloc instead. * peicode.h (pe_ILF_build_a_bfd): Similarly. (ILF_DATA_SIZE): Don't include bim. * opncls.c (bfd_close): Test bim->buffer non-NULL before freeing.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index a0374e3..3337efe 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -709,7 +709,9 @@ bfd_close (bfd *abfd)
vector.
Until that's done, at least don't leak memory. */
struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
- free (bim->buffer);
+
+ if (bim->buffer != NULL)
+ free (bim->buffer);
free (bim);
ret = TRUE;
}