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 5/9] Fix memory leak in tree-vect-slp.c


Leak can be seen e.g. here:
gcc pr68817.f90 -fno-diagnostics-show-caret -fdiagnostics-color=never -O -O3 -ffast-math

gcc/ChangeLog:

2016-05-18  Martin Liska  <mliska@suse.cz>

	* tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Release
	bitmap.
---
 gcc/tree-vect-slp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index d713848..66db7d5 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1308,7 +1308,10 @@ vect_attempt_slp_rearrange_stmts (slp_instance slp_instn)
   FOR_EACH_VEC_ELT (node->load_permutation, i, lidx)
     {
       if (lidx >= group_size)
-	return false;
+	{
+	  sbitmap_free (load_index);
+	  return false;
+	}
       if (bitmap_bit_p (load_index, lidx))
 	{
 	  sbitmap_free (load_index);
-- 
2.8.2



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