Author: janderwald
Date: Tue May 20 09:57:37 2008
New Revision: 33612
URL:
http://svn.reactos.org/svn/reactos?rev=33612&view=rev
Log:
- zero DISPLAY_DEVICEW struct before passing it to NtUserEnumDisplayDevices
- copy string the resulting strings on success but on failure
- fix 2 memory leaks in EnumDisplayMonitors
- fixes a user32_winetest error
Modified:
trunk/reactos/dll/win32/user32/misc/display.c
Modified: trunk/reactos/dll/win32/user32/misc/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/disp…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] Tue May 20 09:57:37 2008
@@ -62,13 +62,14 @@
return FALSE;
}
+ RtlZeroMemory(&DisplayDeviceW, sizeof(DISPLAY_DEVICEW));
DisplayDeviceW.cb = sizeof(DISPLAY_DEVICEW);
rc = NtUserEnumDisplayDevices (
&Device,
iDevNum,
&DisplayDeviceW,
dwFlags );
- if (!rc)
+ if (rc)
{
/* Copy result from DisplayDeviceW to lpDisplayDevice */
lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags;
@@ -169,6 +170,8 @@
if (iCount <= 0)
{
/* FIXME: SetLastError() */
+ HeapFree(hHeap, 0, hMonitorList);
+ HeapFree(hHeap, 0, pRectList);
return FALSE;
}
@@ -188,7 +191,8 @@
if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData))
break;
}
-
+ HeapFree(hHeap, 0, hMonitorList);
+ HeapFree(hHeap, 0, pRectList);
return TRUE;
}