use corresponding free function for png_create_write_struct
Prevents access violation on PNG error in Texture Font Generator
This commit is contained in:
@@ -90,7 +90,7 @@ static bool RageSurface_Save_PNG( RageFile &f, char szErrorbuf[1024], RageSurfac
|
||||
png_info *pInfo = png_create_info_struct(pPng);
|
||||
if( pInfo == NULL )
|
||||
{
|
||||
png_destroy_read_struct( &pPng, NULL, NULL );
|
||||
png_destroy_write_struct( &pPng, NULL );
|
||||
if( bDeleteImg )
|
||||
delete pImg;
|
||||
sprintf( szErrorbuf, "creating png_create_info_struct failed");
|
||||
@@ -99,7 +99,7 @@ static bool RageSurface_Save_PNG( RageFile &f, char szErrorbuf[1024], RageSurfac
|
||||
|
||||
if( setjmp(png_jmpbuf(pPng)) )
|
||||
{
|
||||
png_destroy_read_struct( &pPng, &pInfo, NULL );
|
||||
png_destroy_write_struct( &pPng, &pInfo );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,14 +162,14 @@ bool SavePNG( FILE *f, char szErrorbuf[1024], const Surface *pSurf )
|
||||
png_info *pInfo = png_create_info_struct(pPng);
|
||||
if( pInfo == NULL )
|
||||
{
|
||||
png_destroy_read_struct( &pPng, NULL, NULL );
|
||||
png_destroy_write_struct( &pPng, NULL );
|
||||
sprintf( szErrorbuf, "creating png_create_info_struct failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if( setjmp(png_jmpbuf(pPng)) )
|
||||
{
|
||||
png_destroy_read_struct( &pPng, &pInfo, NULL );
|
||||
png_destroy_write_struct( &pPng, &pInfo );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user