aboutsummaryrefslogtreecommitdiff
path: root/libiberty/argv.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-08-29 00:45:49 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-08-29 00:45:49 +0000
commitbf8247ff45fff9e0b9502c05457f42a32ec5bd8b (patch)
tree01caeee3258681df10e4995db5787a981df5e535 /libiberty/argv.c
parent92fae9b9c3d846c3d3ff90333e7c8d08bec32107 (diff)
downloadgdb-bf8247ff45fff9e0b9502c05457f42a32ec5bd8b.zip
gdb-bf8247ff45fff9e0b9502c05457f42a32ec5bd8b.tar.gz
gdb-bf8247ff45fff9e0b9502c05457f42a32ec5bd8b.tar.bz2
Replace alloca with xmalloc/free
PR binutils/14526 * argv.c (buildargv): Replace alloca with xmalloc/free.
Diffstat (limited to 'libiberty/argv.c')
-rw-r--r--libiberty/argv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libiberty/argv.c b/libiberty/argv.c
index ca53f91..4cef3bc 100644
--- a/libiberty/argv.c
+++ b/libiberty/argv.c
@@ -191,7 +191,7 @@ char **buildargv (const char *input)
if (input != NULL)
{
- copybuf = (char *) alloca (strlen (input) + 1);
+ copybuf = (char *) xmalloc (strlen (input) + 1);
/* Is a do{}while to always execute the loop once. Always return an
argv, even for null strings. See NOTES above, test case below. */
do
@@ -297,6 +297,8 @@ char **buildargv (const char *input)
consume_whitespace (&input);
}
while (*input != EOS);
+
+ free (copybuf);
}
return (argv);
}