aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/io/unit.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index 0030d7e..a3b0656 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -767,9 +767,12 @@ close_unit_1 (gfc_unit *u, int locked)
void
unlock_unit (gfc_unit *u)
{
- NOTE ("unlock_unit = %d", u->unit_number);
- UNLOCK (&u->lock);
- NOTE ("unlock_unit done");
+ if (u)
+ {
+ NOTE ("unlock_unit = %d", u->unit_number);
+ UNLOCK (&u->lock);
+ NOTE ("unlock_unit done");
+ }
}
/* close_unit()-- Close a unit. The stream is closed, and any memory