From ccae0c8546a8b9e6fe00f180ae097a3f83b1e113 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 25 Jul 2016 12:52:30 +0200 Subject: [PATCH] Fix memory leak introduced in r238336 * tree-ssa-loop-niter.c (loop_only_exit_p): Release body array. From-SVN: r238705 --- gcc/ChangeLog | 4 ++++ gcc/tree-ssa-loop-niter.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a6755ab614c..18a969f46e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-07-25 Martin Liska + + * tree-ssa-loop-niter.c (loop_only_exit_p): Release body array. + 2016-07-25 Martin Liska PR tree-optimization/71987 diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index b7d7c324efd..95bb5cf1126 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -2119,7 +2119,10 @@ loop_only_exit_p (const struct loop *loop, const_edge exit) { for (bsi = gsi_start_bb (body[i]); !gsi_end_p (bsi); gsi_next (&bsi)) if (stmt_can_terminate_bb_p (gsi_stmt (bsi))) - return true; + { + free (body); + return true; + } } free (body); -- 2.30.2