Author: tfaber Date: Fri Apr 15 20:24:44 2016 New Revision: 71164
URL: http://svn.reactos.org/svn/reactos?rev=71164&view=rev Log: [WIN32K:NTUSER] - Initialize the window station object before calling ObInsertObject, since the object will be deleted in case of failure. CORE-11124
Modified: trunk/reactos/win32ss/user/ntuser/winsta.c
Modified: trunk/reactos/win32ss/user/ntuser/winsta.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] Fri Apr 15 20:24:44 2016 @@ -460,6 +460,14 @@ return 0; }
+ /* Initialize the window station */ + RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT)); + + InitializeListHead(&WindowStationObject->DesktopListHead); + Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable); + WindowStationObject->Name = WindowStationName; + WindowStationObject->dwSessionId = NtCurrentPeb()->SessionId; + Status = ObInsertObject((PVOID)WindowStationObject, NULL, dwDesiredAccess, @@ -470,19 +478,9 @@ if (!NT_SUCCESS(Status)) { ERR("ObInsertObject failed for window station %wZ\n", &WindowStationName); - ExFreePoolWithTag(WindowStationName.Buffer, TAG_STRING); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - ObDereferenceObject(WindowStationObject); return 0; } - - /* Initialize the window station */ - RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT)); - - InitializeListHead(&WindowStationObject->DesktopListHead); - Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable); - WindowStationObject->Name = WindowStationName; - WindowStationObject->dwSessionId = NtCurrentPeb()->SessionId;
if (InputWindowStation == NULL) {