mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:05:41 +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
1 changed files with 9 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue