SDL_FreeRW() does not close file

It ain’t obvious - or wasn’t obvious to me, at least :slight_smile: - that a
SDL_FreeRW() should be proceeded by a SDL_RWclose() in case the RW-data
was allocated from SDL_RWFromFile() or SDL_RWFromFP(). This is
independent of the hidden.stdio.autoclose var in the SDL_RWops struct.

I’d suggest a change of SDL_FreeRW() as proposed below.

Brgds,
/Daniel Elvin

Index: SDL_rwops.c===================================================================
RCS file: /home/sdlweb/libsdl.org/cvs/SDL12/src/file/SDL_rwops.c,v
retrieving revision 1.9
diff -u -r1.9 SDL_rwops.c
— SDL_rwops.c 24 Jun 2005 12:48:38 -0000 1.9
+++ SDL_rwops.c 13 Oct 2005 21:11:39 -0000
@@ -301,5 +301,8 @@

void SDL_FreeRW(SDL_RWops *area)
{

  •   free(area);
    
  •   if ( area ) {
    
  •           area->close(area);
    
  •           free(area);
    
  •   }
    
    }