From 515ef31dec50185cc5d8a6f88b51832bfd259e87 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 20 Feb 2008 17:42:36 +0000 Subject: 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. --- bfd/vms-misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bfd/vms-misc.c') diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index 98fbb0e..87f7ce8 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -1,7 +1,7 @@ /* vms-misc.c -- Miscellaneous functions for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2007 Free Software Foundation, Inc. + 2007, 2008 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -349,7 +349,7 @@ _bfd_vms_get_record (bfd * abfd) if (PRIV (rec_length) > PRIV (buf_size)) { - PRIV (vms_buf) = bfd_realloc (vms_buf, + PRIV (vms_buf) = bfd_realloc_or_free (vms_buf, (bfd_size_type) PRIV (rec_length)); vms_buf = PRIV (vms_buf); if (vms_buf == 0) -- cgit v1.1