aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2012-08-29 00:46:36 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2012-08-28 17:46:36 -0700
commit55529d369ca6e3abb90f1e316e671d69764da19b (patch)
tree025a9561217264a4ed32568da7a6233f8c8b8df5 /libiberty
parent09ba405a485fa6b65c3d231c059ed07cc704b1f1 (diff)
downloadgcc-55529d369ca6e3abb90f1e316e671d69764da19b.zip
gcc-55529d369ca6e3abb90f1e316e671d69764da19b.tar.gz
gcc-55529d369ca6e3abb90f1e316e671d69764da19b.tar.bz2
Replace alloca with xmalloc/free
PR binutils/14526 * argv.c (buildargv): Replace alloca with xmalloc/free. From-SVN: r190766
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/argv.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 0b720e7..f06dcb5 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/14526
+ * argv.c (buildargv): Replace alloca with xmalloc/free.
+
2012-08-17 Andreas Schwab <schwab@linux-m68k.org>
* floatformat.c (floatformat_to_double): Correctly handle numbers
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);
}