aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2015-01-24 21:52:34 +0000
committerJanne Blomqvist <jb@gcc.gnu.org>2015-01-24 21:52:34 +0000
commitdbb591907900cd9ea12044dd4a6a7e1df23b6304 (patch)
tree0c3d1d607e4cba288e848924dd2fb81811380302 /libgfortran/io
parent94d3e6c04779d33cea49b350e1887237068feb85 (diff)
PR libfortran/64770 Segfault when trying to open existing file with status="new".
libgfortran ChangeLog: 2015-01-24 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/64770 * io/unit.c (filename_from_unit): Check that u->filename != NULL before calling strdup. testsuite ChangeLog: 2015-01-24 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/64770 * gfortran.dg/open_new_segv.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@220086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/unit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index e168d328665..687f5076a5b 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -829,7 +829,7 @@ filename_from_unit (int n)
}
/* Get the filename. */
- if (u != NULL)
+ if (u != NULL && u->filename != NULL)
return strdup (u->filename);
else
return (char *) NULL;