diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-01 21:06:04 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-01 21:06:04 +0000 |
commit | 39bcf29914da7e2f9e22456626758619104cb6d6 (patch) | |
tree | 78997fd39595c6ea1728a0697ea35af66c6f87b7 /libcpp/pch.c | |
parent | 57fad2bf00b5bdbf8129af300933cddf4b966490 (diff) | |
download | gcc-39bcf29914da7e2f9e22456626758619104cb6d6.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196394 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/pch.c')
-rw-r--r-- | libcpp/pch.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libcpp/pch.c b/libcpp/pch.c index 94e5d21ab7a..6270bda53ed 100644 --- a/libcpp/pch.c +++ b/libcpp/pch.c @@ -187,6 +187,16 @@ cpp_string_eq (const void *a_p, const void *b_p) && memcmp (a->text, b->text, a->len) == 0); } +/* Free memory associated with cpp_string. */ + +static void +cpp_string_free (void *a_p) +{ + struct cpp_string *a = (struct cpp_string *) a_p; + free ((void *) a->text); + free (a); +} + /* Save the current definitions of the cpp_reader for dependency checking purposes. When writing a precompiled header, this should be called at the same point in the compilation as cpp_valid_state @@ -198,7 +208,7 @@ cpp_save_state (cpp_reader *r, FILE *f) /* Save the list of non-void identifiers for the dependency checking. */ r->savedstate = XNEW (struct cpp_savedstate); r->savedstate->definedhash = htab_create (100, cpp_string_hash, - cpp_string_eq, NULL); + cpp_string_eq, cpp_string_free); cpp_forall_identifiers (r, save_idents, r->savedstate); /* Write out the list of defined identifiers. */ @@ -336,6 +346,8 @@ cpp_write_pch_deps (cpp_reader *r, FILE *f) return -1; } free (ss->definedstrs); + free (ss->defs); + htab_delete (ss->definedhash); /* Free the saved state. */ free (ss); |