aboutsummaryrefslogtreecommitdiff
path: root/binutils/dlltool.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-03-21 16:31:46 +0000
committerNick Clifton <nickc@redhat.com>2016-03-21 16:31:46 +0000
commite1fa0163505af867009ea73fc5f705162120e795 (patch)
treefd2c95bc22a2dc813c4ab7e70200701f1854d144 /binutils/dlltool.c
parentc55978a67a2e23999c3359a13bb807b665fcb33e (diff)
downloadgdb-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 'binutils/dlltool.c')
-rw-r--r--binutils/dlltool.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index f97c6b4..e116e6b 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1253,7 +1253,7 @@ def_import (const char *app_name, const char *module, const char *dllext,
const char *entry, int ord_val, const char *its_name)
{
const char *application_name;
- char *buf;
+ char *buf = NULL;
if (entry != NULL)
application_name = entry;
@@ -1266,13 +1266,12 @@ def_import (const char *app_name, const char *module, const char *dllext,
}
if (dllext != NULL)
- {
- buf = (char *) alloca (strlen (module) + strlen (dllext) + 2);
- sprintf (buf, "%s.%s", module, dllext);
- module = buf;
- }
+ module = buf = concat (module, ".", dllext, NULL);
append_import (application_name, module, ord_val, its_name);
+
+ if (buf)
+ free (buf);
}
void
@@ -1334,7 +1333,7 @@ run (const char *what, char *args)
if (*s == ' ')
i++;
i++;
- argv = alloca (sizeof (char *) * (i + 3));
+ argv = xmalloc (sizeof (char *) * (i + 3));
i = 0;
argv[i++] = what;
s = args;
@@ -1353,6 +1352,7 @@ run (const char *what, char *args)
pid = pexecute (argv[0], (char * const *) argv, program_name, temp_base,
&errmsg_fmt, &errmsg_arg, PEXECUTE_ONE | PEXECUTE_SEARCH);
+ free(argv);
if (pid == -1)
{
@@ -1986,12 +1986,13 @@ assemble_file (const char * source, const char * dest)
{
char * cmd;
- cmd = (char *) alloca (strlen (ASM_SWITCHES) + strlen (as_flags)
- + strlen (source) + strlen (dest) + 50);
+ cmd = xmalloc (strlen (ASM_SWITCHES) + strlen (as_flags)
+ + strlen (source) + strlen (dest) + 50);
sprintf (cmd, "%s %s -o %s %s", ASM_SWITCHES, as_flags, dest, source);
run (as_name, cmd);
+ free (cmd);
}
static const char * temp_file_to_remove[5];
@@ -3295,7 +3296,7 @@ gen_lib_file (int delay)
{
char *name;
- name = (char *) alloca (strlen (TMP_STUB) + 10);
+ name = xmalloc (strlen (TMP_STUB) + 10);
for (i = 0; (exp = d_exports_lexically[i]); i++)
{
/* Don't delete non-existent stubs for PRIVATE entries. */
@@ -3313,6 +3314,7 @@ gen_lib_file (int delay)
non_fatal (_("cannot delete %s: %s"), name, strerror (errno));
}
}
+ free (name);
}
inform (_("Created lib file"));