aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-09-15 17:42:01 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2012-09-15 17:42:01 +0200
commitfd2805e11b7018a148a4f87201b4d85344b5aad4 (patch)
tree05e97776b1fe54ef1d015ca3c6f07b279078ff83 /gcc/fortran/match.c
parent8385420c4f45090a3393557783d8c7c73ef9a9b7 (diff)
downloadgcc-fd2805e11b7018a148a4f87201b4d85344b5aad4.zip
gcc-fd2805e11b7018a148a4f87201b4d85344b5aad4.tar.gz
gcc-fd2805e11b7018a148a4f87201b4d85344b5aad4.tar.bz2
match.c (lock_unlock_statement, [...]): Fix potential double freeing.
2012-09-15 Tobias Burnus <burnus@net-b.de> * match.c (lock_unlock_statement, sync_statement): Fix potential double freeing. (sync_statement): Remove unreachable code. * simplify.c (gfc_simplify_bessel_n2): Avoid double freeing. (gfc_simplify_repeat): Remove bogus code. * target-memory.h (gfc_target_encode_expr): Update prototype. * target-memory.c (gfc_target_encode_expr, encode_array, encode_derived): Return unsigned HOST_WIDE_INT. (gfc_target_interpret_expr): Add assert. (gfc_merge_initializers): Fix "== 0" check for mpz_t. * symbol.c (gfc_get_typebound_proc): Add assert. (gfc_merge_initializers): Remove unreachable check. From-SVN: r191343
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index cf85d52..d46a495 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2964,11 +2964,15 @@ syntax:
gfc_syntax_error (st);
cleanup:
+ if (acq_lock != tmp)
+ gfc_free_expr (acq_lock);
+ if (errmsg != tmp)
+ gfc_free_expr (errmsg);
+ if (stat != tmp)
+ gfc_free_expr (stat);
+
gfc_free_expr (tmp);
gfc_free_expr (lockvar);
- gfc_free_expr (acq_lock);
- gfc_free_expr (stat);
- gfc_free_expr (errmsg);
return MATCH_ERROR;
}
@@ -3121,9 +3125,6 @@ sync_statement (gfc_statement st)
break;
}
- if (m == MATCH_ERROR)
- goto syntax;
-
if (gfc_match (" )%t") != MATCH_YES)
goto syntax;
@@ -3153,10 +3154,13 @@ syntax:
gfc_syntax_error (st);
cleanup:
+ if (stat != tmp)
+ gfc_free_expr (stat);
+ if (errmsg != tmp)
+ gfc_free_expr (errmsg);
+
gfc_free_expr (tmp);
gfc_free_expr (imageset);
- gfc_free_expr (stat);
- gfc_free_expr (errmsg);
return MATCH_ERROR;
}