aboutsummaryrefslogtreecommitdiff
path: root/bfd/vms-tir.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-02-20 17:42:36 +0000
committerNick Clifton <nickc@redhat.com>2008-02-20 17:42:36 +0000
commit515ef31dec50185cc5d8a6f88b51832bfd259e87 (patch)
tree3b25393193afaf4f670cf6da64ff323faee10203 /bfd/vms-tir.c
parent4443cd0f6e76d3ecb793814445d2e01b41f29fbe (diff)
downloadgdb-515ef31dec50185cc5d8a6f88b51832bfd259e87.zip
gdb-515ef31dec50185cc5d8a6f88b51832bfd259e87.tar.gz
gdb-515ef31dec50185cc5d8a6f88b51832bfd259e87.tar.bz2
PR 868
* libbfd.c (bfd_realloc_or_free): New function. Performs like bfd_realloc, but if the (re)allocation fails, the pointer is freed. * libbfd-in.h: Prototype. * libbfd.h: Regenerate. * bfdio.c (bfd_bwrite): Use the new function. (bfd_seek): Likewise. * bfdwin.c:(bfd_get_file_window): Likewise. * elf-strtab.c (_bfd_elf_strtab_add): Likewise. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-xtensa.c (vsprintf_msg): Likewise. * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise. * stabs.c (_bfd_link_seciton_stabs): Likewise. * vms-misc.c (_bfd_vms_get_record): Likewise. * vms-tir.c (check_section): Likewise. * vms.c (vms_new_section_hook): Likewise. * elf32-arm.c (elf32_arm_section_map_add): Check that the allocation of sec_data->map succeeded before using it. * elflink.c (elf_link_output_sym): Do not overwrite finfo-> symshndxbuf until it is known that the reallocation succeeded.
Diffstat (limited to 'bfd/vms-tir.c')
-rw-r--r--bfd/vms-tir.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c
index de20d4f..e6ec6eb 100644
--- a/bfd/vms-tir.c
+++ b/bfd/vms-tir.c
@@ -1,6 +1,6 @@
/* vms-tir.c -- BFD back-end for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
TIR record handling functions
@@ -51,8 +51,8 @@ check_section (bfd * abfd, int size)
if (offset + size > PRIV (image_section)->size)
{
PRIV (image_section)->contents
- = bfd_realloc (PRIV (image_section)->contents, offset + size);
- if (PRIV (image_section)->contents == 0)
+ = bfd_realloc_or_free (PRIV (image_section)->contents, offset + size);
+ if (PRIV (image_section)->contents == NULL)
{
(*_bfd_error_handler) (_("No Mem !"));
return -1;
@@ -833,8 +833,8 @@ alloc_section (bfd * abfd, unsigned int idx)
amt = idx + 1;
amt *= sizeof (asection *);
- PRIV (sections) = bfd_realloc (PRIV (sections), amt);
- if (PRIV (sections) == 0)
+ PRIV (sections) = bfd_realloc_or_free (PRIV (sections), amt);
+ if (PRIV (sections) == NULL)
return -1;
while (PRIV (section_count) <= idx)