changeset 4201:b10a73ebd7fd SDL-1.2

Forgot to allocate memory for native video mode data.
author Patrice Mandin <patmandin@gmail.com>
date Sun, 20 Sep 2009 18:05:52 +0000
parents 907624b7a72c
children 7ec1d9a34164
files src/video/xbios/SDL_xbios.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/xbios/SDL_xbios.c	Sun Sep 20 12:48:51 2009 +0000
+++ b/src/video/xbios/SDL_xbios.c	Sun Sep 20 18:05:52 2009 +0000
@@ -521,11 +521,21 @@
 	for ( i=0; i<NUM_MODELISTS; ++i ) {
 		int j;
 
-		SDL_xbiosmode[i] = (xbiosmode_t **)SDL_malloc(SDL_nummodes[i]*sizeof(xbiosmode_t));
+		SDL_xbiosmode[i] = (xbiosmode_t **)
+			SDL_malloc(SDL_nummodes[i]*sizeof(xbiosmode_t *));
 		if ( SDL_xbiosmode[i] == NULL ) {
 			SDL_OutOfMemory();
 			return(-1);
 		}
+		for ( j=0; j<SDL_nummodes[i]; ++j ) {
+			SDL_xbiosmode[i][j]=(xbiosmode_t *)SDL_malloc(sizeof(xbiosmode_t));
+			if ( SDL_xbiosmode[i][j] == NULL ) {
+				SDL_OutOfMemory();
+				return(-1);
+			}
+			SDL_memset(SDL_xbiosmode[i][j], 0, sizeof(xbiosmode_t));
+		}
+
 		SDL_modelist[i] = (SDL_Rect **)
 				SDL_malloc((SDL_nummodes[i]+1)*sizeof(SDL_Rect *));
 		if ( SDL_modelist[i] == NULL ) {