[PATCH 2/6] Fix memory leak in tree-ssa

marxin mliska@suse.cz
Mon Nov 23 13:52:00 GMT 2015


gcc/ChangeLog:

2015-11-20  Martin Liska  <mliska@suse.cz>

	* tree-ssa.c (redirect_edge_var_map_destroy): Release
	vectors that are used as a second argument of a hash_map.
---
 gcc/tree-ssa.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 02fca4c..db7d065 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -121,6 +121,11 @@ redirect_edge_var_map_vector (edge e)
 void
 redirect_edge_var_map_destroy (void)
 {
+  if (edge_var_maps)
+    for (hash_map<edge, auto_vec<edge_var_map> >::iterator it =
+	 edge_var_maps->begin (); it != edge_var_maps->end (); ++it)
+      (*it).second.release ();
+
   delete edge_var_maps;
   edge_var_maps = NULL;
 }
-- 
2.6.3




More information about the Gcc-patches mailing list