diff options
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -1,6 +1,6 @@ /* ELF executable support for BFD. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, + 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -2136,12 +2136,16 @@ _bfd_elf_new_section_hook (abfd, sec) asection *sec; { struct bfd_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); - sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt); - if (!sdata) - return FALSE; - sec->used_by_bfd = (PTR) sdata; + sdata = (struct bfd_elf_section_data *) sec->used_by_bfd; + if (sdata == NULL) + { + bfd_size_type amt = sizeof (*sdata); + sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = (PTR) sdata; + } /* Indicate whether or not this section should use RELA relocations. */ sdata->use_rela_p |