fix memleak on error
This commit is contained in:
@@ -79,9 +79,12 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_Surface *volatile surf = NULL;
|
||||||
if( setjmp(png_jmpbuf(png)) )
|
if( setjmp(png_jmpbuf(png)) )
|
||||||
{
|
{
|
||||||
png_destroy_read_struct( &png, &info_ptr, png_infopp_NULL );
|
png_destroy_read_struct( &png, &info_ptr, png_infopp_NULL );
|
||||||
|
if( surf )
|
||||||
|
SDL_FreeSurface( surf );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +184,6 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
|
|||||||
|
|
||||||
png_read_update_info( png, info_ptr );
|
png_read_update_info( png, info_ptr );
|
||||||
|
|
||||||
SDL_Surface *surf;
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case PALETTE:
|
case PALETTE:
|
||||||
|
|||||||
Reference in New Issue
Block a user