This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix leak in predict.c
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Thu, 1 Jan 2004 22:35:47 -0500
- Subject: [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. */