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 leak in predict.c


The last patch in this series of fixing leaks in GCC.

estimate_probability calls get_loop_body which allocates array to basic blocks and
this array never gets free, this patch fixes it.


Bootstrapped on powerpc-apple-darwin7.2.0 with no regressions.
OK for the mainline?


ChangeLog: * predict.c (estimate_probability): Free bbs after being done with it.



Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.94
diff -u -p -r1.94 predict.c
--- predict.c	17 Dec 2003 23:44:45 -0000	1.94
+++ predict.c	2 Jan 2004 03:29:51 -0000
@@ -471,6 +471,9 @@ estimate_probability (struct loops *loop
 		    - predictor_info [(int) PRED_LOOP_EXIT].hitrate)
 		   / exits);
 	}
+
+      /* Free basic blocks from get_loop_body. */
+      free (bbs);
     }

/* Attempt to predict conditional jumps using a number of heuristics. */


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