Commit 5fd6ec3e by Janne Blomqvist

PR 66861 Fix null pointer crash on mingw.

2015-07-14  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/66861
	* io/unix.c (compare_file_filename): Verify that u->filename is
	non-NULL before strcmp.
	(find_file0): Likewise.

From-SVN: r225788
parent 5faebb89
2015-07-14 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/66861
* io/unix.c (compare_file_filename): Verify that u->filename is
non-NULL before strcmp.
(find_file0): Likewise.
2015-07-06 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/40267
......
......@@ -1525,7 +1525,10 @@ compare_file_filename (gfc_unit *u, const char *name, int len)
goto done;
}
# endif
ret = (strcmp(path, u->filename) == 0);
if (u->filename)
ret = (strcmp(path, u->filename) == 0);
else
ret = 0;
#endif
done:
free (path);
......@@ -1570,7 +1573,7 @@ find_file0 (gfc_unit *u, FIND_FILE0_DECL)
}
else
# endif
if (strcmp (u->filename, path) == 0)
if (u->filename && strcmp (u->filename, path) == 0)
return u;
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment