[SDL] HARD WARE SURFACES

Gabriele Greco gabriele.greco at darts.it
Tue Oct 9 06:04:36 PDT 2007


Patricia Curtis wrote:
> 	gLevel	=	SDL_DisplayFormatAlpha(SDL_CreateRGBSurface(SDL_HWSURFACE,SCREEN_WIDTH,SCREEN_HEIGHT,32,RMASK,
> GMASK, BMASK, AMASK));
>   
You are leaking memory here, split the line and free the surface 
allocated with SDL_CreateRGBSurface after SDL_DisplayFormatAlpha.
> 	SDL_Surface * TempSurface			=	SDL_DisplayFormatAlpha(IMG_Load(PathName));
>   
You are leaking memory here too, IMG_Load() returns a pointer to a 
surface you have to free, the point is that SDL_DisplayFormat family 
always return a NEW surface so you have to remove the original one :)

-- 
Bye,
 Gabry





More information about the SDL mailing list