From fd2805e11b7018a148a4f87201b4d85344b5aad4 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sat, 15 Sep 2012 17:42:01 +0200 Subject: match.c (lock_unlock_statement, [...]): Fix potential double freeing. 2012-09-15 Tobias Burnus * 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 --- gcc/fortran/match.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'gcc/fortran/match.c') 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; } -- cgit v1.1