From c527574fb43eba1794efe53286ea862de53899fc Mon Sep 17 00:00:00 2001 From: hubicka Date: Thu, 11 Sep 2008 12:36:53 +0000 Subject: [PATCH] * tree-ssa-pre.c (phi_translate_1): Fix memory leak git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140283 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/tree-ssa-pre.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53fc1a4..d7a06fb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2008-09-11 Jan Hubicka + * tree-ssa-pre.c (phi_translate_1): Fix memory leak + +2008-09-11 Jan Hubicka + * tree-ssa.c (redirect_edge_var_map_clear): Fix formatting. (free_var_map_entry): New function. (redirect_edge_var_map_destroy): Use it. diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index a54999b..053616d 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -1579,7 +1579,10 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2, VEC_free (vn_reference_op_s, heap, newoperands); if (result && is_gimple_min_invariant (result)) - return get_or_alloc_expr_for_constant (result); + { + gcc_assert (!newoperands); + return get_or_alloc_expr_for_constant (result); + } expr = (pre_expr) pool_alloc (pre_expr_pool); expr->kind = REFERENCE; @@ -1599,11 +1602,13 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2, newref = vn_reference_insert_pieces (newvuses, newoperands, result, new_val_id); + newoperands = NULL; PRE_EXPR_REFERENCE (expr) = newref; get_or_alloc_expression_id (expr); } add_to_value (new_val_id, expr); } + VEC_free (vn_reference_op_s, heap, newoperands); phi_trans_add (oldexpr, expr, pred); return expr; } -- 2.7.4