aboutsummaryrefslogtreecommitdiff
path: root/libcpp/files.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-03-01 22:06:04 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2013-03-01 22:06:04 +0100
commit3b8af25b7ad47b31463046af1f244ad7af5900a9 (patch)
tree78997fd39595c6ea1728a0697ea35af66c6f87b7 /libcpp/files.c
parent689eaba3227c8616894de845d38ef9c8e10de9a1 (diff)
downloadgcc-3b8af25b7ad47b31463046af1f244ad7af5900a9.zip
gcc-3b8af25b7ad47b31463046af1f244ad7af5900a9.tar.gz
gcc-3b8af25b7ad47b31463046af1f244ad7af5900a9.tar.bz2
re PR middle-end/56461 (GCC is leaking lots of memory)
PR middle-end/56461 * files.c (_cpp_save_file_entries): Free result at the end. * pch.c (cpp_string_free): New function. (cpp_save_state): Use it in htab_create call. (cpp_write_pch_deps): Free ss->defs. Destroy ss->definedhash. From-SVN: r196394
Diffstat (limited to 'libcpp/files.c')
-rw-r--r--libcpp/files.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libcpp/files.c b/libcpp/files.c
index a614b7c..dae5526 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -1771,6 +1771,7 @@ _cpp_save_file_entries (cpp_reader *pfile, FILE *fp)
struct pchf_data *result;
size_t result_size;
_cpp_file *f;
+ bool ret;
for (f = pfile->all_files; f; f = f->next_file)
++count;
@@ -1827,7 +1828,9 @@ _cpp_save_file_entries (cpp_reader *pfile, FILE *fp)
qsort (result->entries, result->count, sizeof (struct pchf_entry),
pchf_save_compare);
- return fwrite (result, result_size, 1, fp) == 1;
+ ret = fwrite (result, result_size, 1, fp) == 1;
+ free (result);
+ return ret;
}
/* Read the pchf_data structure from F. */