From: Thomas Faber Date: Fri, 15 Apr 2016 20:24:44 +0000 (+0000) Subject: [WIN32K:NTUSER] X-Git-Tag: ReactOS-0.4.1~60 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=8ab4a127ba241002603edf2d336776b8d7021901 [WIN32K:NTUSER] - Initialize the window station object before calling ObInsertObject, since the object will be deleted in case of failure. CORE-11124 svn path=/trunk/; revision=71164 --- diff --git a/reactos/win32ss/user/ntuser/winsta.c b/reactos/win32ss/user/ntuser/winsta.c index fedacf52bdd..4ab17030dfe 100644 --- a/reactos/win32ss/user/ntuser/winsta.c +++ b/reactos/win32ss/user/ntuser/winsta.c @@ -460,6 +460,14 @@ NtUserCreateWindowStation( 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,20 +478,10 @@ NtUserCreateWindowStation( 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) { ERR("Initializing input window station\n");