diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-29 00:46:36 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-29 00:46:36 +0000 |
commit | 890f5a8be8a00601fb98a238349932626f9505c0 (patch) | |
tree | 025a9561217264a4ed32568da7a6233f8c8b8df5 /libiberty/argv.c | |
parent | b52b3c61326d65f557caa94434d6037c74ea2c7f (diff) | |
download | gcc-890f5a8be8a00601fb98a238349932626f9505c0.tar.gz |
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
Diffstat (limited to 'libiberty/argv.c')
-rw-r--r-- | libiberty/argv.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); } |