Author: gedmurphy
Date: Tue Aug 14 00:20:31 2007
New Revision: 28323
URL:
http://svn.reactos.org/svn/reactos?rev=28323&view=rev
Log:
Don't overshoot the for loop, fixes a memory leak
Modified:
trunk/reactos/dll/cpl/desk/settings.c
Modified: trunk/reactos/dll/cpl/desk/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/settings.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/desk/settings.c (original)
+++ trunk/reactos/dll/cpl/desk/settings.c Tue Aug 14 00:20:31 2007
@@ -87,6 +87,7 @@
HDC hDC;
PSETTINGS_ENTRY Current;
DWORD bpp, xres, yres, checkbpp;
+
/* Get current settings */
*CurrentSettings = NULL;
@@ -176,10 +177,17 @@
newEntry->InitialSettings.dmBitsPerPel =
newEntry->CurrentSettings->dmBitsPerPel;
/* Count different resolutions */
+ /* Count different resolutions */
for (Current = newEntry->Settings; Current != NULL; Current = Current->Flink)
+ {
if (Current->Flink != NULL &&
- ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) ||
(Current->dmPelsHeight != Current->Flink->dmPelsHeight)))
+ ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) ||
+ (Current->dmPelsHeight != Current->Flink->dmPelsHeight)))
+ {
ResolutionsCount++;
+ }
+ }
+
newEntry->Resolutions = HeapAlloc(GetProcessHeap(), 0, ResolutionsCount *
sizeof(RESOLUTION_INFO));
if (!newEntry->Resolutions) goto ByeBye;
newEntry->ResolutionsCount = ResolutionsCount;