diff --git a/dll/win32/kernel32/client/procansi.c b/dll/win32/kernel32/client/procansi.c index 2d9753da841..3bd389490f6 100644 --- a/dll/win32/kernel32/client/procansi.c +++ b/dll/win32/kernel32/client/procansi.c @@ -287,8 +287,6 @@ GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) } /* Someone beat us to it, we will use their data instead */ - Status = STATUS_SUCCESS; - /* We're going to free our own stuff, but not raise */ RtlFreeAnsiString(&TitleString); } @@ -297,9 +295,6 @@ GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) RtlFreeAnsiString(&ShellString); } RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo); - - /* Get the cached information again: either still NULL or set by another thread */ - StartupInfo = BaseAnsiStartupInfo; } else { @@ -307,8 +302,12 @@ GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) Status = STATUS_NO_MEMORY; } - /* Raise an error unless we got here due to the race condition */ - if (!StartupInfo) RtlRaiseStatus(Status); + /* Raise an error if there is no cached information */ + if (!BaseAnsiStartupInfo) + RtlRaiseStatus(Status); + + /* Get the cached information again: set by another thread */ + StartupInfo = BaseAnsiStartupInfo; } /* Now copy from the cached ANSI version */