mirror of
https://github.com/reactos/reactos.git
synced 2024-10-21 00:18:26 +00:00
Don't overshoot the for loop, fixes a memory leak
svn path=/trunk/; revision=28323
This commit is contained in:
parent
cb14899998
commit
95a14312ca
|
@ -88,6 +88,7 @@ GetPossibleSettings(IN LPTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTIN
|
|||
PSETTINGS_ENTRY Current;
|
||||
DWORD bpp, xres, yres, checkbpp;
|
||||
|
||||
|
||||
/* Get current settings */
|
||||
*CurrentSettings = NULL;
|
||||
hDC = CreateIC(NULL, DeviceName, NULL, NULL);
|
||||
|
@ -175,11 +176,18 @@ AddDisplayDevice(IN PGLOBAL_DATA pGlobalData, IN LPTSTR Description, IN LPTSTR D
|
|||
newEntry->InitialSettings.dmPelsHeight = newEntry->CurrentSettings->dmPelsHeight;
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue