From 10775a138ef2a8613a7ee9b056746666d4cc9172 Mon Sep 17 00:00:00 2001 From: Parth Wazurkar Date: Tue, 10 Jul 2018 14:16:52 +0530 Subject: [PATCH] [gf] Fix memory leak errors. * src/gf/gfdrivr.c: Improve GF_Face_Done and GF_Face_Init functions to fix memory leak errors. --- src/gf/gfdrivr.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gf/gfdrivr.c b/src/gf/gfdrivr.c index 6ce866575..7726033b9 100644 --- a/src/gf/gfdrivr.c +++ b/src/gf/gfdrivr.c @@ -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 )