From 487e54f29acc5750992ab2e07574b872a32973ee Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 30 Jul 2002 05:49:24 +0000 Subject: * aoutx.h (some_aout_object_p): Clean up tdata properly on error. * archive.c (bfd_generic_archive_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p): Likewise. (_bfd_xcoff_archive_p): Use bfd_scan_vma in place of strtol. * coff64-rs6000.c (xcoff64_slurp_armap): Likewise. (xcoff64_archive_p): Likewise. (xcoff64_openr_next_archived_file): Likewise. (xcoff64_archive_p): Clean up tdata properly on error. * coffgen.c (coff_real_object_p): Likewise. (coff_object_p): Release filehdr and opthdr. * ecoff.c (_bfd_ecoff_archive_p): Clean up tdata properly on error. * ieee.c (ieee_archive_p): Likewise. * ihex.c (ihex_object_p): Likewise. (ihex_mkobject): Always allocate tdata. * peicode.h (pe_ILF_object_p): Release bfd_alloc'd buffer on error. * srec.c (srec_mkobject): Always allocate tdata. (srec_object_p): Clean up tdata properly on error. (symbolsrec_object_p): Likewise. * versados.c (versados_object_p): Likewise. * vms-misc.c (_bfd_vms_get_record): Use bfd_malloc instead of malloc, and bfd_realloc instead of realloc. (add_new_contents): Use bfd_alloc instead of bfd_malloc for sections. * vms.c (vms_initialize): Always allocate tdata. Use bfd_alloc in place of bfd_malloc, simplifying error freeing. Free hash table too. (vms_object_p): Clean up tdata on error. (vms_mkobject): Don't complain on stderr if vms_initialize fails. (vms_close_and_cleanup): Adjust for bfd_alloc use. --- bfd/peicode.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bfd/peicode.h') diff --git a/bfd/peicode.h b/bfd/peicode.h index c20e9a3..a621acc 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -1207,7 +1207,10 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc return NULL; if (bfd_bread (ptr, size, abfd) != size) - return NULL; + { + bfd_release (abfd, ptr); + return NULL; + } symbol_name = ptr; source_dll = ptr + strlen (ptr) + 1; @@ -1219,14 +1222,17 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc (_("%s: string not null terminated in ILF object file."), bfd_archive_filename (abfd)); bfd_set_error (bfd_error_malformed_archive); - + bfd_release (abfd, ptr); return NULL; } /* Now construct the bfd. */ if (! pe_ILF_build_a_bfd (abfd, magic, symbol_name, source_dll, ordinal, types)) - return NULL; + { + bfd_release (abfd, ptr); + return NULL; + } return abfd->xvec; } -- cgit v1.1