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 ipa-cp memory leaks (PR middle-end/56461)


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


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