[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 12 Oct 2014 11:43:10 +0000 (11:43 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 12 Oct 2014 11:43:10 +0000 (11:43 +0000)
Properly reset FCB & SectionObjectPointer fields from the FileObject on close

svn path=/trunk/; revision=64691

reactos/drivers/filesystems/ntfs/close.c

index 1ce7659..a51329b 100644 (file)
@@ -42,12 +42,14 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
               PFILE_OBJECT FileObject)
 {
     PNTFS_CCB Ccb;
+    PNTFS_FCB Fcb;
 
     DPRINT("NtfsCloseFile(DeviceExt %p, FileObject %p)\n",
            DeviceExt,
            FileObject);
 
     Ccb = (PNTFS_CCB)(FileObject->FsContext2);
+    Fcb = (PNTFS_FCB)(FileObject->FsContext);
 
     DPRINT("Ccb %p\n", Ccb);
     if (Ccb == NULL)
@@ -56,13 +58,15 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
     }
 
     FileObject->FsContext2 = NULL;
+    FileObject->FsContext = NULL;
+    FileObject->SectionObjectPointer = NULL;
 
     if (FileObject->FileName.Buffer)
     {
         // This a FO, that was created outside from FSD.
         // Some FO's are created with IoCreateStreamFileObject() insid from FSD.
         // This FO's don't have a FileName.
-        NtfsReleaseFCB(DeviceExt, FileObject->FsContext);
+        NtfsReleaseFCB(DeviceExt, Fcb);
     }
 
     if (Ccb->DirectorySearchPattern)