From 96d3cffec0d9bcc2324384d27413aee3eb37317b 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/libbfd-in.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bfd/libbfd-in.h') diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index ec11bd5d6b..f57d450a4f 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -99,6 +99,8 @@ extern void *bfd_malloc (bfd_size_type); extern void *bfd_realloc (void *, bfd_size_type); +extern void *bfd_realloc_or_free + (void *, bfd_size_type); extern void *bfd_zmalloc (bfd_size_type); extern void *bfd_malloc2 -- cgit v1.2.1