This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch #PR 25933] memory leaks
Thanks Ian for reviewing this patch and being patient with me.
> Well, I was trying to suggest that you also move the sbitmap_alloc
> call until after the call to tpa_init. Then you don't have to do
> anything special if tpa_init fails--you can just return NULL as the
> code currently does.
>
> The patch is OK with that change.
Here is the updated complete patch.
------------------------------------------------------------------------------
2006-01-23 Uttam Pawar <uttamp@us.ibm.com>
PR middle-end/25933
* loop-unroll.c (unroll_loop_runtime_iterations): Fix for
a memory leak.
* tree-ssa-live.c (type_var_init): Fix for a memory leak.
diff -urpN trunk.orig/gcc/loop-unroll.c trunk/gcc/loop-unroll.c
--- trunk.orig/gcc/loop-unroll.c 2006-01-18 10:03:20.000000000 -0800
+++ trunk/gcc/loop-unroll.c 2006-01-24 10:00:16.000000000 -0800
@@ -1168,6 +1168,9 @@ unroll_loop_runtime_iterations (struct l
";; Unrolled loop %d times, counting # of iterations "
"in runtime, %i insns\n",
max_unroll, num_loop_insns (loop));
+
+ if (dom_bbs)
+ free (dom_bbs);
}
/* Decide whether to simply peel LOOP and how much. */
diff -urpN trunk.orig/gcc/tree-ssa-live.c trunk/gcc/tree-ssa-live.c
--- trunk.orig/gcc/tree-ssa-live.c 2006-01-18 10:03:20.000000000 -0800
+++ trunk/gcc/tree-ssa-live.c 2006-01-27 09:39:37.000000000 -0800
@@ -1078,13 +1078,13 @@ type_var_init (var_map map)
tree t;
sbitmap seen;
- seen = sbitmap_alloc (num_partitions);
- sbitmap_zero (seen);
-
tv = tpa_init (map);
if (!tv)
return NULL;
+ seen = sbitmap_alloc (num_partitions);
+ sbitmap_zero (seen);
+
for (x = num_partitions - 1; x >= 0; x--)
{
t = partition_to_var (map, x);