From 8bb94bcd8e71a06f92c9961df019f3fcd50a53cd Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 29 Aug 2012 00:45:49 +0000 Subject: Replace alloca with xmalloc/free PR binutils/14526 * argv.c (buildargv): Replace alloca with xmalloc/free. --- libiberty/ChangeLog | 5 +++++ libiberty/argv.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'libiberty') diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 0b720e762d7..f06dcb52a66 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,8 @@ +2011-08-28 H.J. Lu + + PR binutils/14526 + * argv.c (buildargv): Replace alloca with xmalloc/free. + 2012-08-17 Andreas Schwab * floatformat.c (floatformat_to_double): Correctly handle numbers diff --git a/libiberty/argv.c b/libiberty/argv.c index ca53f91493d..4cef3bc5b5b 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); } -- cgit v1.2.1