[ros-diffs] [arty] 44176: Fix file dereference bug. Now we only dereference the file in one place after the section is created.

arty at svn.reactos.org arty at svn.reactos.org
Sun Nov 15 19:17:18 CET 2009


Author: arty
Date: Sun Nov 15 19:17:18 2009
New Revision: 44176

URL: http://svn.reactos.org/svn/reactos?rev=44176&view=rev
Log:
Fix file dereference bug.  Now we only dereference the file in one place after the section
is created.

Modified:
    branches/arty-newcc/ntoskrnl/mm/section/data.c

Modified: branches/arty-newcc/ntoskrnl/mm/section/data.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/data.c?rev=44176&r1=44175&r2=44176&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] Sun Nov 15 19:17:18 2009
@@ -1630,6 +1630,7 @@
     * Reference the file handle
     */
    ObReferenceObject(FileObject);
+   Section->FileObject = FileObject;
 
    DPRINT("Getting original file size\n");
    /* A hack: If we're cached, we can overcome deadlocking with the upper
@@ -1655,7 +1656,6 @@
        if (!NT_SUCCESS(Status))
        {
 		   ObDereferenceObject(Section);
-		   ObDereferenceObject(FileObject);
 		   return Status;
        }
 	   ASSERT(Status != STATUS_PENDING);
@@ -1683,7 +1683,6 @@
    if (MaximumSize.QuadPart == 0)
    {
 	   ObDereferenceObject(Section);
-	   ObDereferenceObject(FileObject);
 	   return STATUS_FILE_INVALID;
    }
 
@@ -1692,7 +1691,6 @@
    if (Segment == NULL)
    {
        ObDereferenceObject(Section);
-       ObDereferenceObject(FileObject);
        return(STATUS_NO_MEMORY);
    }
 
@@ -1762,7 +1760,6 @@
 
    MmUnlockSectionSegment(Segment);
 
-   Section->FileObject = FileObject;
    Section->MaximumSize.QuadPart = MaximumSize.QuadPart;
 
    /* Extend file if section is longer */
@@ -1778,7 +1775,6 @@
 	   {
 		   DPRINT1("Could not expand section\n");
 		   ObDereferenceObject(Section);
-		   ObDereferenceObject(FileObject);
 		   return Status;
 	   }
    }




More information about the Ros-diffs mailing list