[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] memory leak
From: |
王毅 |
Subject: |
[Devel] memory leak |
Date: |
Mon, 21 Jan 2002 13:44:39 +0800 |
Hi,
File: src\cff\cffdrivr.c
Function: cff_get_name_index()
In the function, CFF_Get_Name() will allocate some memory for the
variable 'name'. But at the end the function won't free the memory. I
think the code should like this:
static FT_UInt
cff_get_name_index( CFF_Face face,
FT_String* glyph_name )
{
CFF_Font* cff;
CFF_Charset* charset;
PSNames_Interface* psnames;
FT_Memory memory = FT_FACE_MEMORY(face);
FT_String* name;
FT_UShort sid;
FT_UInt i;
FT_Int ret;
cff = face->extra.data;
charset = &cff->charset;
psnames = (PSNames_Interface*)FT_Get_Module_Interface(
face->root.driver->root.library, "psnames" );
for ( i = 0; i < cff->num_glyphs; i++ )
{
sid = charset->sids[i];
if ( sid > 390 )
name = CFF_Get_Name( &cff->string_index, sid - 391 );
else
name = (FT_String *)psnames->adobe_std_strings( sid );
ret = strcmp( glyph_name, name );
if ( sid > 390 )
FREE( name );
if ( !ret )
return i;
}
return 0;
}
Jacky
- [Devel] memory leak,
王毅 <=