Forgot to allocate memory for native video mode data. SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sun, 20 Sep 2009 18:05:52 +0000
branchSDL-1.2
changeset 4201b10a73ebd7fd
parent 4200 907624b7a72c
child 4202 7ec1d9a34164
Forgot to allocate memory for native video mode data.
src/video/xbios/SDL_xbios.c
     1.1 --- a/src/video/xbios/SDL_xbios.c	Sun Sep 20 12:48:51 2009 +0000
     1.2 +++ b/src/video/xbios/SDL_xbios.c	Sun Sep 20 18:05:52 2009 +0000
     1.3 @@ -521,11 +521,21 @@
     1.4  	for ( i=0; i<NUM_MODELISTS; ++i ) {
     1.5  		int j;
     1.6  
     1.7 -		SDL_xbiosmode[i] = (xbiosmode_t **)SDL_malloc(SDL_nummodes[i]*sizeof(xbiosmode_t));
     1.8 +		SDL_xbiosmode[i] = (xbiosmode_t **)
     1.9 +			SDL_malloc(SDL_nummodes[i]*sizeof(xbiosmode_t *));
    1.10  		if ( SDL_xbiosmode[i] == NULL ) {
    1.11  			SDL_OutOfMemory();
    1.12  			return(-1);
    1.13  		}
    1.14 +		for ( j=0; j<SDL_nummodes[i]; ++j ) {
    1.15 +			SDL_xbiosmode[i][j]=(xbiosmode_t *)SDL_malloc(sizeof(xbiosmode_t));
    1.16 +			if ( SDL_xbiosmode[i][j] == NULL ) {
    1.17 +				SDL_OutOfMemory();
    1.18 +				return(-1);
    1.19 +			}
    1.20 +			SDL_memset(SDL_xbiosmode[i][j], 0, sizeof(xbiosmode_t));
    1.21 +		}
    1.22 +
    1.23  		SDL_modelist[i] = (SDL_Rect **)
    1.24  				SDL_malloc((SDL_nummodes[i]+1)*sizeof(SDL_Rect *));
    1.25  		if ( SDL_modelist[i] == NULL ) {