]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/c-pch.c
re PR pch/13675 (#including a precompiled header more than once in the same unit...
[thirdparty/gcc.git] / gcc / c-pch.c
index 691e12a2f797e619cda522bf377f3a46effc330a..0da17f7f24ba80906db72c3841aad70116ded4ca 100644 (file)
@@ -373,6 +373,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
   if (f == NULL)
     {
       cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
+      close (fd);
       return;
     }
 
@@ -381,6 +382,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
   if (fread (&h, sizeof (h), 1, f) != 1)
     {
       cpp_errno (pfile, CPP_DL_ERROR, "reading");
+      fclose (f);
       return;
     }
 
@@ -417,7 +419,10 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
   gt_pch_restore (f);
 
   if (cpp_read_state (pfile, name, f, smd) != 0)
-    return;
+    {
+      fclose (f);
+      return;
+    }
 
   fclose (f);