Patchwork [2/3] Fix memory leaks in new scop detection.

login
register
mail settings
Submitter Sebastian Pop
Date Sept. 23, 2010, 3:52 p.m.
Message ID <1285257170-11174-2-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/65545/
State New
Headers show

Comments

Sebastian Pop - Sept. 23, 2010, 3:52 p.m.
2010-09-23  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-scop-detection.c (is_scop_p): Free bblist.
---
 gcc/ChangeLog.graphite        |    4 ++++
 gcc/graphite-scop-detection.c |    6 +++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

Patch

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index d8305b9..9e7ff70 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,9 @@ 
 2010-09-23  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-scop-detection.c (is_scop_p): Free bblist.
+
+2010-09-23  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-clast-to-gimple.c (compute_bounds_for_level): Free le
 	and ps.
 	* graphite-poly.c (pbb_number_of_iterations_at_time): Free le and
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 6437556..e300ee1 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1463,7 +1463,10 @@  is_scop_p (refined_region_p region)
   for (i = 0; VEC_iterate (basic_block, bblist, i, bb_iter); i++)
     {
       if (!is_valid_bb_p (region, bb_iter))
-	return false;
+	{
+	  VEC_free (basic_block, heap, bblist);
+	  return false;
+	}
 
       /* TODO: Do all loops have a number of iterations that can be expressed
 	 by an affine linear function.  */
@@ -1476,6 +1479,7 @@  is_scop_p (refined_region_p region)
      All loops are detected by gcc's loop detection?
      All conditions are well nested?  */
 
+  VEC_free (basic_block, heap, bblist);
   return true;
 }