Author: tfaber
Date: Mon May 8 08:29:17 2017
New Revision: 74497
URL:
http://svn.reactos.org/svn/reactos?rev=74497&view=rev
Log:
[USER32]
- Avoid a memory leak in User32EnumWindows in case the window count is zero.
CORE-13194
Modified:
trunk/reactos/win32ss/user/user32/windows/window.c
Modified: trunk/reactos/win32ss/user/user32/windows/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] Mon May 8 08:29:17
2017
@@ -674,6 +674,14 @@
if (!NT_SUCCESS(Status))
return FALSE;
+ if (!dwCount)
+ {
+ if (!dwThreadId)
+ return FALSE;
+ else
+ return TRUE;
+ }
+
/* allocate buffer to receive HWND handles */
hHeap = GetProcessHeap();
pHwnd = HeapAlloc(hHeap, 0, sizeof(HWND)*(dwCount+1));
@@ -696,14 +704,6 @@
if (pHwnd)
HeapFree(hHeap, 0, pHwnd);
return FALSE;
- }
-
- if (!dwCount)
- {
- if (!dwThreadId)
- return FALSE;
- else
- return TRUE;
}
/* call the user's callback function until we're done or