public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v7)] Fix memory leaks.
Date: Thu,  9 Dec 2021 12:49:12 +0000 (GMT)	[thread overview]
Message-ID: <20211209124912.85DB2385842C@sourceware.org> (raw)

https://gcc.gnu.org/g:589094d78e42b87fc28a1385bf56fb630602e3c7

commit 589094d78e42b87fc28a1385bf56fb630602e3c7
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Dec 8 19:37:02 2021 +0100

    Fix memory leaks.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 961c6f20478..dac859ad1e5 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -210,6 +210,7 @@ init_loop_unswitch_info (class loop *loop,
 	set_predicates_for_bb (bbs[i], candidates);
       else
 	{
+	  candidates.release ();
 	  gimple *last = last_stmt (bbs[i]);
 	  if (last != NULL)
 	    gimple_set_uid (last, 0);
@@ -248,7 +249,16 @@ tree_ssa_unswitch_loops (void)
 	  predicate_path.create (8);
 	  changed |= tree_unswitch_single_loop (loop, 0, predicate_path,
 						budget, ignored_edge_flag);
+	  predicate_path.release ();
 
+	  for (auto predlist: bb_predicates)
+	    {
+	      for (auto predicate: predlist)
+		delete predicate;
+	      predlist.release ();
+	    }
+
+	  bb_predicates->release ();
 	  delete bb_predicates;
 	  bb_predicates = NULL;
 	}


             reply	other threads:[~2021-12-09 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 12:49 Martin Liska [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-12-08 18:37 Martin Liska

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=20211209124912.85DB2385842C@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).