[gf] Fix memory leak errors.

* src/gf/gfdrivr.c: Improve GF_Face_Done and
GF_Face_Init functions to fix memory leak errors.
This commit is contained in:
Parth Wazurkar 2018-07-10 14:16:52 +05:30
parent 2c3b6390a5
commit 10775a138e
1 changed files with 10 additions and 9 deletions

View File

@ -142,9 +142,9 @@
memory = FT_FACE_MEMORY( face );
/*gf_free_font( face );*/
gf_free_font( face );
/*FT_FREE( gfface->available_sizes );*/
FT_FREE( gfface->available_sizes );
}
@ -186,7 +186,7 @@
{
FT_TRACE2(( "glyph bitmaps not allocated\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
goto Exit;
}
/* GF cannot have multiple faces in a single font file.
@ -229,7 +229,7 @@
{
FT_ERROR(( "GF_Face_Init: glyphs not allocated\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
goto Exit;
}
gfface->num_fixed_sizes = 1;
@ -264,21 +264,22 @@
error = FT_CMap_New( &gf_cmap_class, NULL, &charmap, NULL );
if ( error )
goto Fail;
goto Exit;
}
if ( go->code_max < go->code_min )
{
FT_TRACE2(( "invalid number of glyphs\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
goto Exit;
}
Fail:
GF_Face_Done( gfface );
Exit:
return error;
Fail:
GF_Face_Done( gfface );
return FT_THROW( Unknown_File_Format );
}
FT_CALLBACK_DEF( FT_Error )