Commit 6a2bf10f by Tobias Burnus Committed by Tobias Burnus

trans-array.c (gfc_array_allocate, [...]): Plug memory leak.

2013-07-22  Tobias Burnus  <burnus@net-b.de>

        * trans-array.c (gfc_array_allocate,
        gfc_trans_deferred_array): Plug memory leak.

From-SVN: r201125
parent 859abddd
2013-07-22 Tobias Burnus <burnus@net-b.de>
* trans-array.c (gfc_array_allocate,
gfc_trans_deferred_array): Plug memory leak.
2013-07-21 Ondřej Bílka <neleai@seznam.cz> 2013-07-21 Ondřej Bílka <neleai@seznam.cz>
* trans-decl.c: Fix comment typos. * trans-decl.c: Fix comment typos.
......
...@@ -5209,7 +5209,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, ...@@ -5209,7 +5209,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
&se->pre, &set_descriptor_block, &overflow, &se->pre, &set_descriptor_block, &overflow,
expr3_elem_size, nelems, expr3, ts); expr3_elem_size, nelems, expr3, ts);
if (dimension) if (status == NULL_TREE && dimension)
{ {
var_overflow = gfc_create_var (integer_type_node, "overflow"); var_overflow = gfc_create_var (integer_type_node, "overflow");
...@@ -5223,8 +5223,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, ...@@ -5223,8 +5223,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
error = build_call_expr_loc (input_location, gfor_fndecl_runtime_error, error = build_call_expr_loc (input_location, gfor_fndecl_runtime_error,
1, msg); 1, msg);
} }
else if (status != NULL_TREE)
if (status != NULL_TREE)
{ {
tree status_type = TREE_TYPE (status); tree status_type = TREE_TYPE (status);
stmtblock_t set_status_block; stmtblock_t set_status_block;
...@@ -8525,10 +8524,12 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block) ...@@ -8525,10 +8524,12 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block)
&& !sym->attr.save && !sym->attr.result && !sym->attr.save && !sym->attr.result
&& !sym->ns->proc_name->attr.is_main_program) && !sym->ns->proc_name->attr.is_main_program)
{ {
gfc_expr *e;
e = has_finalizer ? gfc_lval_expr_from_sym (sym) : NULL;
tmp = gfc_trans_dealloc_allocated (sym->backend_decl, tmp = gfc_trans_dealloc_allocated (sym->backend_decl,
sym->attr.codimension, sym->attr.codimension, e);
has_finalizer if (e)
? gfc_lval_expr_from_sym (sym) : NULL); gfc_free_expr (e);
gfc_add_expr_to_block (&cleanup, tmp); gfc_add_expr_to_block (&cleanup, tmp);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment