https://git.reactos.org/?p=reactos.git;a=commitdiff;h=092c37f845cd76bd5821d5fcd6e7fdd57ba96dd9

commit 092c37f845cd76bd5821d5fcd6e7fdd57ba96dd9
Author:     Pierre Schweitzer <[email protected]>
AuthorDate: Fri Mar 29 19:51:38 2019 +0100
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Fri Mar 29 19:51:38 2019 +0100

    [NTOSKRNL] Do. Not. L. E. A. K.
---
 ntoskrnl/io/iomgr/iofunc.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index 5fd1a130ef..e6ecefc7ff 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -4121,29 +4121,18 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
         }
         _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
-            /* Check if we had a file lock */
-            if (FileObject->Flags & FO_SYNCHRONOUS_IO)
-            {
-                /* Release it */
-                IopUnlockFileObject(FileObject);
-            }
-
-            /* Dereference the FO */
-            ObDereferenceObject(FileObject);
-
+            /* Cleanup */
+            IopCleanupAfterException(FileObject, NULL, NULL, Event);
             _SEH2_YIELD(return _SEH2_GetExceptionCode());
         }
         _SEH2_END;
 
-        /* Check if we had a file lock */
-        if (FileObject->Flags & FO_SYNCHRONOUS_IO)
-        {
-            /* Release it */
-            IopUnlockFileObject(FileObject);
-        }
-
-        /* Dereference the FO */
-        ObDereferenceObject(FileObject);
+        /*
+         * We didn't have an exception, but we didn't issue an IRP
+         * to complete either, so avoid duplicating code and
+         * call appropriate helper
+         */
+        IopCleanupAfterException(FileObject, NULL, NULL, Event);
 
         return STATUS_SUCCESS;
     }

Reply via email to