summaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2009-10-16 07:14:42 +0000
committerAlan Modra <amodra@bigpond.net.au>2009-10-16 07:14:42 +0000
commit33128827937dafd906bb3cc00f719406494d975c (patch)
tree65aa557a7563a3af64f257e3d3299be1456e63a8 /bfd/opncls.c
parent7040659f0918ef776e14b2fac307dab8bcc072d9 (diff)
downloadbinutils-redhat-33128827937dafd906bb3cc00f719406494d975c.tar.gz
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 a0374e31dc..3337efe0e8 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;
}