From 9e7b37b31f29ad3b8321d15e589ed5de550c56d3 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 5 Jan 2002 13:11:33 +0000 Subject: * section.c (bfd_section_init): Remove unnecessary initialisations. (bfd_section_list_clear): New function. (bfd_section_list_remove, bfd_section_list_insert): New macros. (_bfd_strip_section_from_output): Use them. * coffcode.h (coff_set_alignment_hook): Likewise. * elf32-mips.c (_bfd_mips_elf_final_link): Likewise. * elf64-mips.c (mips_elf64_final_link): Likewise. * elf64-mmix.c (mmix_elf_final_link): Likewise. * sunos.c (sunos_add_dynamic_symbols): Likewise. * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise. * bfd-in2.h: Regenerate. * netbsd-core.c (netbsd_core_file_p): Use bfd_make_section_anyway rather than doing our own section handling. Clean up after errors with bfd_release and bfd_section_list_clear. Handle unexpected flags. * aoutf1.h (sunos4_core_file_p): Likewise. * aix386-core.c (aix386_core_file_p): Likewise. * cisco-core.c (cisco_core_file_validate): Likewise. * ptrace-core.c (ptrace_unix_core_file_p): Likewise. * trad-core.c (trad_unix_core_file_p): Likewise. * hppabsd-core.c (hppabsd_core_core_file_p): Clean up after errors with bfd_release and bfd_section_list_clear. * hpux-core.c (hpux_core_core_file_p): Likewise. * irix-core.c (irix_core_core_file_p): Likewise. * lynx-core.c (lynx_core_file_p): Likewise. * osf-core.c (osf_core_core_file_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * sco5-core.c (sco5_core_file_p): Likewise. --- bfd/hppabsd-core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'bfd/hppabsd-core.c') diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c index dd0ffda..3fb76cc 100644 --- a/bfd/hppabsd-core.c +++ b/bfd/hppabsd-core.c @@ -1,5 +1,5 @@ /* BFD back-end for HPPA BSD core files. - Copyright 1993, 1994, 1995, 1998, 1999, 2001 + Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -183,6 +183,8 @@ hppabsd_core_core_file_p (abfd) clicksz * u.u_ssize, NBPG * (USIZE + KSTAKSIZE) + clicksz * u.u_dsize, 2); + if (core_stacksec (abfd) == NULL) + goto fail; core_stacksec (abfd)->vma = USRSTACK; core_datasec (abfd) = make_bfd_asection (abfd, ".data", @@ -190,17 +192,27 @@ hppabsd_core_core_file_p (abfd) + SEC_HAS_CONTENTS, clicksz * u.u_dsize, NBPG * (USIZE + KSTAKSIZE), 2); + if (core_datasec (abfd) == NULL) + goto fail; core_datasec (abfd)->vma = UDATASEG; core_regsec (abfd) = make_bfd_asection (abfd, ".reg", SEC_HAS_CONTENTS, KSTAKSIZE * NBPG, NBPG * USIZE, 2); + if (core_regsec (abfd) == NULL) + goto fail; core_regsec (abfd)->vma = 0; strncpy (core_command (abfd), u.u_comm, MAXCOMLEN + 1); core_signal (abfd) = u.u_code; return abfd->xvec; + + fail: + bfd_release (abfd, abfd->tdata.any); + abfd->tdata.any = NULL; + bfd_section_list_clear (abfd); + return NULL; } static char * -- cgit v1.1