Fix crash in VESA accelerant.

- Keep track of the correct number of initial modes available.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42438 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Bruno G. Albuquerque 2011-07-16 13:59:06 +00:00
parent 07ec2fab02
commit 5eed3d9892
1 changed files with 3 additions and 1 deletions

View File

@ -79,10 +79,12 @@ create_mode_list(void)
// Create the initial list from the support mode list - but only if we don't
// have EDID info available, as that should be good enough.
display_mode* initialModes = NULL;
uint32 initialModesCount = 0;
if (!gInfo->shared_info->has_edid) {
initialModes = (display_mode*)malloc(
sizeof(display_mode) * gInfo->shared_info->vesa_mode_count);
if (initialModes != NULL) {
initialModesCount = gInfo->shared_info->vesa_mode_count;
vesa_mode* vesaModes = gInfo->vesa_modes;
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
@ -95,7 +97,7 @@ create_mode_list(void)
gInfo->mode_list_area = create_display_modes("vesa modes",
gInfo->shared_info->has_edid ? &gInfo->shared_info->edid_info : NULL,
initialModes, gInfo->shared_info->vesa_mode_count,
initialModes, initialModesCount,
kVesaSpaces, sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]),
is_mode_supported, &gInfo->mode_list, &gInfo->shared_info->mode_count);