From: Aditya Kumar Date: Thu, 21 Jan 2016 02:13:24 +0000 (+0000) Subject: fix memory leak in scop-detection X-Git-Tag: upstream/12.2.0~49314 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eaca025e57accd92cabab3eaf09d5a27e056d184;p=platform%2Fupstream%2Fgcc.git fix memory leak in scop-detection * graphite-scop-detection.c (scop_detection::harmful_loop_in_region): Free dom and loops. (scop_detection::loop_body_is_valid_scop): Free bbs. Co-Authored-By: Sebastian Pop From-SVN: r232655 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ca0bb51..3d9efe2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2016-01-21 Aditya Kumar Sebastian Pop + * graphite-scop-detection.c + (scop_detection::harmful_loop_in_region): Free dom and loops. + (scop_detection::loop_body_is_valid_scop): Free bbs. + +2016-01-21 Aditya Kumar + Sebastian Pop + * graphite-scop-detection.c (record_loop_in_sese): New. (gather_bbs::before_dom_children): Call record_loop_in_sese. (build_scops): Remove call to build_sese_loop_nests. diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 68b9f4d..d1b0fec 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);