[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Tue, 21 Oct 2014 10:45:49 +0000 (10:45 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Tue, 21 Oct 2014 10:45:49 +0000 (10:45 +0000)
 - Avoid use after free in debug configuration
CORE-8661 #resolve

svn path=/trunk/; revision=64862

reactos/win32ss/user/ntuser/object.c

index 01964de..321d90f 100644 (file)
@@ -710,14 +710,15 @@ UserSetObjectOwner(PVOID obj, HANDLE_TYPE type, PVOID owner)
             return;
     }
 
-    oldppi->UserHandleCount--;
-    IntDereferenceProcessInfo(oldppi);
-    ppi->UserHandleCount++;
-    IntReferenceProcessInfo(ppi);
 #if DBG
     oldppi->DbgHandleCount[type]--;
     ppi->DbgHandleCount[type]++;
 #endif
+
+    oldppi->UserHandleCount--;
+    IntDereferenceProcessInfo(oldppi);
+    ppi->UserHandleCount++;
+    IntReferenceProcessInfo(ppi);
 }
 
 BOOLEAN