diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-05-29 13:34:38 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-05-29 13:34:38 +0200 |
commit | 92b05e72eab38351ab9a486e0e0ec9db11f4413b (patch) | |
tree | c2b60359132356dcde0e153b19936cc26691c1d9 /gcc/gcov.c | |
parent | 4f7f7aca357246cb38a1a4f9e1177f5adfd3f25e (diff) | |
download | gcc-92b05e72eab38351ab9a486e0e0ec9db11f4413b.zip gcc-92b05e72eab38351ab9a486e0e0ec9db11f4413b.tar.gz gcc-92b05e72eab38351ab9a486e0e0ec9db11f4413b.tar.bz2 |
re PR middle-end/53510 (OOM while compile some code)
PR middle-end/53510
* input.c (read_line): Use XRESIZEVEC instead of XNEWVEC
to avoid leaking memory. No need to handle memory allocation
failure. Double string_len on each reallocation instead of
adding 2.
* gcov.c (read_line): Likewise.
From-SVN: r187952
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r-- | gcc/gcov.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -2219,15 +2219,8 @@ read_line (FILE *file) return string; } pos += len; - ptr = XNEWVEC (char, string_len * 2); - if (ptr) - { - memcpy (ptr, string, pos); - string = ptr; - string_len += 2; - } - else - pos = 0; + string = XRESIZEVEC (char, string, string_len * 2); + string_len *= 2; } return pos ? string : NULL; |