From 890f5a8be8a00601fb98a238349932626f9505c0 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 29 Aug 2012 00:46:36 +0000 Subject: Replace alloca with xmalloc/free PR binutils/14526 * argv.c (buildargv): Replace alloca with xmalloc/free. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190766 138bc75d-0d04-0410-961f-82ee72b054a4 --- libiberty/argv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libiberty/argv.c') 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