From 5eed3d989274a8689744af60aec0894d94b7d733 Mon Sep 17 00:00:00 2001 From: "Bruno G. Albuquerque" Date: Sat, 16 Jul 2011 13:59:06 +0000 Subject: [PATCH] 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 --- src/add-ons/accelerants/vesa/mode.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index c1d06e22f6..d010b99ec5 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -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);