- Avoid a memory leak in User32EnumWindows in case the window count is zero.
CORE-13194

svn path=/trunk/; revision=74497
This commit is contained in:
Thomas Faber 2017-05-08 08:29:17 +00:00
parent ba1fcb6554
commit 0db63068ac

View file

@ -674,6 +674,14 @@ User32EnumWindows(HDESK hDesktop,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return FALSE; return FALSE;
if (!dwCount)
{
if (!dwThreadId)
return FALSE;
else
return TRUE;
}
/* allocate buffer to receive HWND handles */ /* allocate buffer to receive HWND handles */
hHeap = GetProcessHeap(); hHeap = GetProcessHeap();
pHwnd = HeapAlloc(hHeap, 0, sizeof(HWND)*(dwCount+1)); pHwnd = HeapAlloc(hHeap, 0, sizeof(HWND)*(dwCount+1));
@ -698,14 +706,6 @@ User32EnumWindows(HDESK hDesktop,
return FALSE; return FALSE;
} }
if (!dwCount)
{
if (!dwThreadId)
return FALSE;
else
return TRUE;
}
/* call the user's callback function until we're done or /* call the user's callback function until we're done or
they tell us to quit */ they tell us to quit */
for ( i = 0; i < dwCount; i++ ) for ( i = 0; i < dwCount; i++ )