[SDL] Parashute

Данилов Александр Анатольевич alteest at urap.ru
Tue Jul 16 10:30:13 PDT 2002


just doing some memory-leak checking (for TuxPaint) and discovered an 
8-byte leak (surface->hwdata) on *software* DD surfaces.

All DD surfaces have hwdata (contains pointers to DD surface interfaces).

In 'video/SDL_surface.c', SDL_FreeSurface() only frees the hwdata
(by calling video->FreeHWSurface()) if the surface flags indicate
that it is a *hardware* surface.

I propose that this be changed to a test of surface->hwdata as
indicated below. This would be in keeping with other resource
deallocation in this function.

void SDL_FreeSurface (SDL_Surface *surface)
/* if ( (surface->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {    */
 if ( surface->hwdata ) {
  SDL_VideoDevice *video = current_video;
  SDL_VideoDevice *this  = current_video;
  video->FreeHWSurface(this, surface);


More information about the SDL mailing list