public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ipa-cp memory leaks (PR middle-end/56461)
@ 2013-02-27 16:24 Jakub Jelinek
  2013-02-27 19:51 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-02-27 16:24 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

known_aggs is freed/released in another function, but not in
decide_whether_version_node, where it leaks memory.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2013-02-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/56461
	* ipa-cp.c (decide_whether_version_node): Call vec_free on
	known_aggs[i].items and release known_aggs vector.

--- gcc/ipa-cp.c.jj	2013-02-21 22:24:12.000000000 +0100
+++ gcc/ipa-cp.c	2013-02-27 09:25:48.557980184 +0100
@@ -3406,6 +3406,9 @@ decide_whether_version_node (struct cgra
       info = IPA_NODE_REF (node);
       info->do_clone_for_all_contexts = false;
       IPA_NODE_REF (clone)->is_all_contexts_clone = true;
+      for (i = 0; i < count ; i++)
+	vec_free (known_aggs[i].items);
+      known_aggs.release ();
       ret = true;
     }
   else

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix ipa-cp memory leaks (PR middle-end/56461)
  2013-02-27 16:24 [PATCH] Fix ipa-cp memory leaks (PR middle-end/56461) Jakub Jelinek
@ 2013-02-27 19:51 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-02-27 19:51 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 2/27/13 4:59 PM, Jakub Jelinek wrote:
> Hi!
> 
> known_aggs is freed/released in another function, but not in
> decide_whether_version_node, where it leaks memory.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?

Ok.

Thanks,
Richard.

> 2013-02-27  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/56461
> 	* ipa-cp.c (decide_whether_version_node): Call vec_free on
> 	known_aggs[i].items and release known_aggs vector.
> 
> --- gcc/ipa-cp.c.jj	2013-02-21 22:24:12.000000000 +0100
> +++ gcc/ipa-cp.c	2013-02-27 09:25:48.557980184 +0100
> @@ -3406,6 +3406,9 @@ decide_whether_version_node (struct cgra
>        info = IPA_NODE_REF (node);
>        info->do_clone_for_all_contexts = false;
>        IPA_NODE_REF (clone)->is_all_contexts_clone = true;
> +      for (i = 0; i < count ; i++)
> +	vec_free (known_aggs[i].items);
> +      known_aggs.release ();
>        ret = true;
>      }
>    else
> 
> 	Jakub
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-27 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 16:24 [PATCH] Fix ipa-cp memory leaks (PR middle-end/56461) Jakub Jelinek
2013-02-27 19:51 ` Richard Biener

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).