diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-22 07:04:09 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-22 07:04:09 +0000 |
commit | f9b3b191ac10891c7a83b570a67fe71889566078 (patch) | |
tree | 07c6969e6a73cf6ab6f5d8446c0dce4a68d456ae /gcc/fortran/module.c | |
parent | b384c0ce966ed82f59f377953329551a4c7e8136 (diff) | |
download | gcc-f9b3b191ac10891c7a83b570a67fe71889566078.tar.gz |
PR fortran/40195
* module.c (read_md5_from_module_file): Close file before returning.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 2a48f88dbda..82a41996ca4 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4759,7 +4759,7 @@ read_md5_from_module_file (const char * filename, unsigned char md5[16]) if ((file = fopen (filename, "r")) == NULL) return -1; - /* Read two lines. */ + /* Read the first line. */ if (fgets (buf, sizeof (buf) - 1, file) == NULL) { fclose (file); @@ -4769,8 +4769,12 @@ read_md5_from_module_file (const char * filename, unsigned char md5[16]) /* The file also needs to be overwritten if the version number changed. */ n = strlen ("GFORTRAN module version '" MOD_VERSION "' created"); if (strncmp (buf, "GFORTRAN module version '" MOD_VERSION "' created", n) != 0) - return -1; + { + fclose (file); + return -1; + } + /* Read a second line. */ if (fgets (buf, sizeof (buf) - 1, file) == NULL) { fclose (file); |