OSDN Git Service

-------------------------------------------------------------------
[pf3gnuchains/gcc-fork.git] / libgfortran / io / lock.c
index 21d04d7..d85c9b8 100644 (file)
@@ -1,5 +1,5 @@
 /* Thread/recursion locking
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Paul Brook <paul@nowt.org> and Andy Vaught
 
 This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -73,20 +73,28 @@ library_end (void)
   g.in_library = 0;
   filename = NULL;
   line = 0;
-
   t = ioparm.library_return;
+
+  /* Delete the namelist, if it exists.  */
+
   if (ionml != NULL)
     {
       t1 = ionml;
       while (t1 != NULL)
-       {
-         t2 = t1;
-         t1 = t1->next;
-         free_mem (t2);
-       }
+       {
+         t2 = t1;
+         t1 = t1->next;
+         free_mem (t2->var_name);
+         if (t2->var_rank)
+           {
+            free_mem (t2->dim);
+            free_mem (t2->ls);
+           }
+         free_mem (t2);
+       }
     }
-  
   ionml = NULL;
+
   memset (&ioparm, '\0', sizeof (ioparm));
   ioparm.library_return = t;
 }