diff options
author | Nick Clifton <nickc@redhat.com> | 2016-03-21 16:31:46 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-03-21 16:31:46 +0000 |
commit | e1fa0163505af867009ea73fc5f705162120e795 (patch) | |
tree | fd2c95bc22a2dc813c4ab7e70200701f1854d144 /gas/config/obj-elf.c | |
parent | c55978a67a2e23999c3359a13bb807b665fcb33e (diff) | |
download | gdb-e1fa0163505af867009ea73fc5f705162120e795.zip gdb-e1fa0163505af867009ea73fc5f705162120e795.tar.gz gdb-e1fa0163505af867009ea73fc5f705162120e795.tar.bz2 |
Remove use of alloca.
bfd * warning.m4 (GCC_WARN_CFLAGS): Add -Wstack-usage=262144
* configure: Regenerate.
* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Replace use of
alloca with call to xmalloc.
* elf32-nds32.c: Likewise.
* elf64-hppa.c: Likewise.
* elfxx-mips.c: Likewise.
* pef.c: Likewise.
* pei-x86_64.c: Likewise.
* som.c: Likewise.
* xsym.c: Likewise.
binutils * dlltool.c: Replace use of alloca with call to xmalloc.
* dllwrap.c: Likewise.
* nlmconv.c: Likewise.
* objdump.c: Likewise.
* resrc.c: Likewise.
* winduni.c: Likewise.
* configure: Regenerate.
gas * atof-generic.c: Replace use of alloca with call to xmalloc.
* cgen.c: Likewise.
* dwarf2dbg.c: Likewise.
* macro.c: Likewise.
* remap.c: Likewise.
* stabs.c: Likewise.
* symbols.c: Likewise.
* config/obj-elf.c: Likewise.
* config/tc-aarch64.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-avr.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-msp430.c: Likewise.
* config/tc-nds32.c: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-sh.c: Likewise.
* config/tc-tic30.c: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-xstormy16.c: Likewise.
* config/te-vms.c: Likewise.
* configure: Regenerate.
ld * emultempl/msp430.em: Replace use of alloca with call to xmalloc.
* plugin.c: Likewise.
* pe-dll.c: Likewise.
Diffstat (limited to 'gas/config/obj-elf.c')
-rw-r--r-- | gas/config/obj-elf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index e8af394..bacaca3 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1607,7 +1607,7 @@ obj_elf_vendor_attribute (int vendor) if (i == 0) goto bad; - name = (char *) alloca (i + 1); + name = xmalloc (i + 1); memcpy (name, s, i); name[i] = '\0'; @@ -1620,8 +1620,10 @@ obj_elf_vendor_attribute (int vendor) { as_bad (_("Attribute name not recognised: %s"), name); ignore_rest_of_line (); + free (name); return 0; } + free (name); } type = _bfd_elf_obj_attrs_arg_type (stdoutput, vendor, tag); @@ -2085,9 +2087,7 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) if (!strcmp ("str", sec->name + strlen (sec->name) - 3)) return; - name = (char *) alloca (strlen (sec->name) + 4); - strcpy (name, sec->name); - strcat (name, "str"); + name = concat (sec->name, "str", NULL); strsec = bfd_get_section_by_name (abfd, name); if (strsec) strsz = bfd_section_size (abfd, strsec); @@ -2100,6 +2100,7 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) bfd_h_put_16 (abfd, nsyms, p + 6); bfd_h_put_32 (abfd, strsz, p + 8); + free (name); } #ifdef NEED_ECOFF_DEBUG |