Patchwork [fortran,8/22] Various minor fixups

login
register
mail settings
Submitter Mikael Morin
Date Oct. 5, 2010, 10:11 a.m.
Message ID <20101005100948.1836.72703@gimli.local>
Download mbox | patch
Permalink /patch/66807/
State New
Headers show

Comments

Mikael Morin - Oct. 5, 2010, 10:11 a.m.
2010-10-04  Mikael Morin  <mikael@gcc.gnu.org>

	* resolve.c (check_typebound_baseobject): Free local expr before
	returning.

Patch

diff --git a/resolve.c b/resolve.c
index 5cac71e..203f294 100644
--- a/resolve.c
+++ b/resolve.c
@@ -5404,6 +5404,7 @@  static gfc_try
 check_typebound_baseobject (gfc_expr* e)
 {
   gfc_expr* base;
+  gfc_try return_value = FAILURE;
 
   base = extract_compcall_passed_object (e);
   if (!base)
@@ -5415,7 +5416,7 @@  check_typebound_baseobject (gfc_expr* e)
     {
       gfc_error ("Base object for type-bound procedure call at %L is of"
 		 " ABSTRACT type '%s'", &e->where, base->ts.u.derived->name);
-      return FAILURE;
+      goto cleanup;
     }
 
   /* If the procedure called is NOPASS, the base object must be scalar.  */
@@ -5423,7 +5424,7 @@  check_typebound_baseobject (gfc_expr* e)
     {
       gfc_error ("Base object for NOPASS type-bound procedure call at %L must"
 		 " be scalar", &e->where);
-      return FAILURE;
+      goto cleanup;
     }
 
   /* FIXME: Remove once PR 41177 (this problem) is fixed completely.  */
@@ -5431,10 +5432,14 @@  check_typebound_baseobject (gfc_expr* e)
     {
       gfc_error ("Non-scalar base object at %L currently not implemented",
 		 &e->where);
-      return FAILURE;
+      goto cleanup;
     }
 
-  return SUCCESS;
+  return_value = SUCCESS;
+
+cleanup:
+  gfc_free_expr (base);
+  return return_value;
 }