This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix memory leak in tree_estimate_loop_size (PR middle-end/56461)


Hi!

path vector has been only released when return false; later in the function,
but not in this case.  Bootstrapped/regtested on x86_64-linux and
i686-linux, ok for trunk?

2013-03-01  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/56461
	* tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Release path
	vector even when returning true.  Fix up function comment formatting.

--- gcc/tree-ssa-loop-ivcanon.c.jj	2013-01-11 09:02:48.000000000 +0100
+++ gcc/tree-ssa-loop-ivcanon.c	2013-03-01 17:16:51.955088637 +0100
@@ -207,7 +207,7 @@ constant_after_peeling (tree op, gimple
    EDGE_TO_CANCEL (if non-NULL) is an non-exit edge eliminated in the last iteration
    of loop.
    Return results in SIZE, estimate benefits for complete unrolling exiting by EXIT. 
-   Stop estimating after UPPER_BOUND is met. Return true in this case */
+   Stop estimating after UPPER_BOUND is met.  Return true in this case.  */
 
 static bool
 tree_estimate_loop_size (struct loop *loop, edge exit, edge edge_to_cancel, struct loop_size *size,
@@ -321,6 +321,7 @@ tree_estimate_loop_size (struct loop *lo
 	      - size->last_iteration_eliminated_by_peeling) > upper_bound)
 	    {
               free (body);
+	      path.release ();
 	      return true;
 	    }
 	}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]