aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-08-27 22:51:52 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2012-08-27 22:51:52 +0200
commitd7920cf0719e3cc28e61a98d640f6d1cb46d797e (patch)
tree092fbbcb6b239972d8e2bd5aaf151a519254118d /gcc
parent655c54442de3358d0880de6d23b17223775eccd6 (diff)
downloadgcc-d7920cf0719e3cc28e61a98d640f6d1cb46d797e.zip
gcc-d7920cf0719e3cc28e61a98d640f6d1cb46d797e.tar.gz
gcc-d7920cf0719e3cc28e61a98d640f6d1cb46d797e.tar.bz2
re PR fortran/54384 (gfortran memory leaks)
2012-08-27 Tobias Burnus <burnus@net-b.de> PR fortran/54384 * resolve.c (gfc_resolve_character_operator): Free temporary variables. * trans-expr.c (gfc_conv_statement_function): Ditto. From-SVN: r190731
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/resolve.c7
-rw-r--r--gcc/fortran/trans-expr.c1
3 files changed, 14 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d384d38..68d1f75 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,6 +1,13 @@
2012-08-27 Tobias Burnus <burnus@net-b.de>
PR fortran/54384
+ * resolve.c (gfc_resolve_character_operator): Free temporary
+ variables.
+ * trans-expr.c (gfc_conv_statement_function): Ditto.
+
+2012-08-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54384
* dependency.c (check_section_vs_section): Use gfc_free_expr
instead of free.
* trans-intrinsic.c (conv_generic_with_optional_char_arg): Use
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 63b730c..312713b 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5593,7 +5593,12 @@ gfc_resolve_character_operator (gfc_expr *e)
e->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
if (!e1 || !e2)
- return;
+ {
+ gfc_free_expr (e1);
+ gfc_free_expr (e2);
+
+ return;
+ }
e->ts.u.cl->length = gfc_add (e1, e2);
e->ts.u.cl->length->ts.type = BT_INTEGER;
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 3ab7d5d..84a4b34 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5080,6 +5080,7 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr)
/* Restore the original variables. */
for (fargs = sym->formal, n = 0; fargs; fargs = fargs->next, n++)
gfc_restore_sym (fargs->sym, &saved_vars[n]);
+ free (temp_vars);
free (saved_vars);
}