mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
fixed a memory leak in EnterCriticalPolicySection()
svn path=/trunk/; revision=20810
This commit is contained in:
parent
c3ac273c24
commit
57fdde9558
1 changed files with 17 additions and 17 deletions
|
@ -477,29 +477,29 @@ EnterCriticalPolicySection(IN BOOL bMachine)
|
|||
|
||||
/* create or open the mutex */
|
||||
lpSecurityDescriptor = CreateDefaultSecurityDescriptor();
|
||||
if (lpSecurityDescriptor == NULL)
|
||||
if (lpSecurityDescriptor != NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
SecurityAttributes.lpSecurityDescriptor = lpSecurityDescriptor;
|
||||
SecurityAttributes.bInheritHandle = FALSE;
|
||||
|
||||
SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
SecurityAttributes.lpSecurityDescriptor = lpSecurityDescriptor;
|
||||
SecurityAttributes.bInheritHandle = FALSE;
|
||||
hSection = CreateMutexW(&SecurityAttributes,
|
||||
FALSE,
|
||||
(bMachine ? szMachineGPMutex : szLocalGPMutex));
|
||||
|
||||
hSection = CreateMutexW(&SecurityAttributes,
|
||||
FALSE,
|
||||
(bMachine ? szMachineGPMutex : szLocalGPMutex));
|
||||
LocalFree((HLOCAL)lpSecurityDescriptor);
|
||||
|
||||
if (hSection != NULL)
|
||||
{
|
||||
/* wait up to 10 seconds */
|
||||
if (WaitForSingleObject(hSection,
|
||||
60000) != WAIT_FAILED)
|
||||
if (hSection != NULL)
|
||||
{
|
||||
return hSection;
|
||||
}
|
||||
/* wait up to 10 seconds */
|
||||
if (WaitForSingleObject(hSection,
|
||||
60000) != WAIT_FAILED)
|
||||
{
|
||||
return hSection;
|
||||
}
|
||||
|
||||
CloseHandle(hSection);
|
||||
CloseHandle(hSection);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue