https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1e579843bcf2f54da8e71…
commit 1e579843bcf2f54da8e717ec9713b86e9ad1c02c
Author:     Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Mar 18 18:14:17 2018 +0100
Commit:     Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Mar 18 18:16:55 2018 +0100
    [NTOSKNRL] Always reference a newly created VACB
    This allows being consistent between newly created and looked up
    so that VACB can always safely be released.
    Should really help with reference issues.
    CORE-14481
    CORE-14480
    CORE-14482
---
 ntoskrnl/cc/view.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index 6a295504c3..e896c57093 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -808,6 +808,9 @@ CcRosCreateVacb (
         ExFreeToNPagedLookasideList(&VacbLookasideList, current);
     }
+    /* Reference it to allow release */
+    CcRosVacbIncRefCount(current);
+
     return Status;
 }
@@ -842,8 +845,6 @@ CcRosGetVacb (
         {
             return Status;
         }
-
-        CcRosVacbIncRefCount(current);
     }
     KeAcquireGuardedMutex(&ViewLock);