resolve.c (check_typebound_baseobject): Free local expr before returning.
authorMikael Morin <mikael@gcc.gnu.org>
Wed, 6 Oct 2010 14:52:02 +0000 (14:52 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Wed, 6 Oct 2010 14:52:02 +0000 (14:52 +0000)
2010-10-06  Mikael Morin  <mikael@gcc.gnu.org>

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

From-SVN: r165034

gcc/fortran/ChangeLog
gcc/fortran/resolve.c

index 86175478a9ce969135e2ae173d59b3e6d4b75d46..6d729de660cd2d076074d34bf55481116a542828 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-06  Mikael Morin  <mikael@gcc.gnu.org>
+
+       * resolve.c (check_typebound_baseobject): Free local expr before
+       returning.
+
 2010-10-06  Mikael Morin  <mikael@gcc.gnu.org>
 
        * primary.c (gfc_match_structure_constructor): Invert the assert logic.
index 5cac71e51a9fbdc5911b2bed16860a51563eeb97..203f294200ae0e482f2fa3871a66620201ab4a07 100644 (file)
@@ -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;
 }