public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <spop@codeaurora.org>
To: gcc-patches@gcc.gnu.org
Cc: hiraditya@msn.com,	sebpop@gmail.com,	richard.guenther@gmail.com,
	Sebastian Pop <s.pop@samsung.com>
Subject: [PATCH 09/15] fix memory leak in scop-detection
Date: Fri, 15 Jan 2016 17:15:00 -0000	[thread overview]
Message-ID: <1452878086-19297-9-git-send-email-sebpop@gmail.com> (raw)
In-Reply-To: <1452878086-19297-1-git-send-email-sebpop@gmail.com>

From: Sebastian Pop <s.pop@samsung.com>

        * graphite-scop-detection.c
        (scop_detection::harmful_loop_in_region): Free dom and loops.
        (scop_detection::loop_body_is_valid_scop): Free bbs.
---
 gcc/graphite-scop-detection.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index be33be3..a0c630b 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1088,7 +1088,11 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
 	     any loop fully contained in the scop: other bbs are checked below
 	     in loop_is_valid_in_scop.  */
 	  if (harmful_stmt_in_bb (scop, bb))
-	    return true;
+	    {
+	      dom.release ();
+	      BITMAP_FREE (loops);
+	      return true;
+	    }
 	}
 
     }
@@ -1104,13 +1108,14 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
 
       if (!loop_is_valid_in_scop (loop, scop))
 	{
+	  dom.release ();
 	  BITMAP_FREE (loops);
 	  return true;
 	}
     }
 
-  BITMAP_FREE (loops);
   dom.release ();
+  BITMAP_FREE (loops);
   return false;
 }
 
@@ -1503,7 +1508,10 @@ scop_detection::loop_body_is_valid_scop (loop_p loop, sese_l scop) const
       basic_block bb = bbs[i];
 
       if (harmful_stmt_in_bb (scop, bb))
-	return false;
+	{
+	  free (bbs);
+	  return false;
+	}
     }
   free (bbs);
 
-- 
2.5.0

  reply	other threads:[~2016-01-15 17:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
2016-01-15 17:15 ` Sebastian Pop [this message]
2016-01-15 17:15 ` [PATCH 08/15] record loops in execution order Sebastian Pop
2016-01-15 17:15 ` [PATCH 13/15] reinstantiate loop blocking Sebastian Pop
2016-01-15 17:15 ` [PATCH 04/15] add missing ast node for isl 0.15 Sebastian Pop
2016-01-15 17:15 ` [PATCH 03/15] fix PR68343: disable graphite tests for isl 0.14 or earlier Sebastian Pop
2016-01-15 17:15 ` [PATCH 06/15] fix codegen error exposed by compute isl flow patch Sebastian Pop
2016-01-15 17:15 ` [PATCH 10/15] rewrite computation of iteration domains Sebastian Pop
2016-01-15 17:15 ` [PATCH 05/15] remove tiling Sebastian Pop
2016-01-15 17:15 ` [PATCH 02/15] remove unused variable Sebastian Pop
2016-01-15 17:15 ` [PATCH 11/15] check for unstructured control flow Sebastian Pop
2016-01-15 17:15 ` [PATCH 07/15] check that all loops are valid in the combined region Sebastian Pop
2016-01-15 17:16 ` [PATCH 12/15] new scop schedule Sebastian Pop
2016-01-21 14:22 ` [PATCH 01/15] add more coalescing to simplify constraints Matthew Wahab
2016-01-21 14:33   ` Matthew Wahab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452878086-19297-9-git-send-email-sebpop@gmail.com \
    --to=spop@codeaurora.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hiraditya@msn.com \
    --cc=richard.guenther@gmail.com \
    --cc=s.pop@samsung.com \
    --cc=sebpop@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).