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 | |
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
-rw-r--r-- | libiberty/ChangeLog | 5 | ||||
-rw-r--r-- | libiberty/argv.c | 4 |
2 files changed, 8 insertions, 1 deletions
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 <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 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); } |