* src/cid/cidobjs.c (CID_Face_Done): fixed a memory leak, the subrs

routines were never released when CID faces were destroyed
This commit is contained in:
David Turner 2001-12-21 15:26:19 +00:00
parent 5fd895c9f4
commit 637dd17647
7 changed files with 41 additions and 7 deletions

View File

@ -1,5 +1,9 @@
2001-12-21 David Turner <david@freetype.org>
* include/freetype/cache/ftcmanag.h, include/freetype/cache/ftcimage.h,
include/freetype/cache/ftcsbits.h: updating documentation to better
explain the use of the "anode" output parameter in lookup functions
* src/pshinter/pshglob.c (psh_globals_new): Replaced a floating
point constant with a fixed-float equivalent. For some reasons not
all compilers are capable of directly computing a floating pointer

View File

@ -170,6 +170,7 @@ FT_BEGIN_HEADER
/* */
/* anode :: used to return the address of of the corresponding */
/* cache node after incrementing its reference count */
/* (see note below) */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */

View File

@ -152,7 +152,7 @@ FT_BEGIN_HEADER
/* between abstract @FTC_FaceID values and real */
/* @FT_Face objects. */
/* */
/* families :: XXX */
/* families :: global table of families. */
/* */
typedef struct FTC_ManagerRec_
{

View File

@ -164,10 +164,9 @@ FT_BEGIN_HEADER
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
/* anode :: An opaque cache node pointer that will be used */
/* to release the sbit once it becomes unuseful. */
/* Can be NULL, in which case this function will */
/* have the same effect as @FTC_SBitCache_Lookup. XXX */
/* anode :: used to return the address of of the corresponding */
/* cache node after incrementing its reference count */
/* (see note below) */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@ -181,6 +180,17 @@ FT_BEGIN_HEADER
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If "anode" is _not_ NULL, it receives the address of the cache */
/* node containing the bitmap, after increasing its reference */
/* count. This ensures that the node (as well as the image) will */
/* always be kept in the cache until you call @FTC_Node_Unref to */
/* "release" it. */
/* */
/* If "anode" is NULL, the cache node is left unchanged, which means */
/* that the bitmap could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Just don't assume */
/* that it's persistent.. */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageDesc* desc,

View File

@ -446,7 +446,7 @@
if ( FILE_Seek( cid->data_offset + offsets[0] ) ||
FILE_Read( subr->code[0], data_len ) )
goto Exit;
goto Fail;
/* set up pointers */
for ( count = 1; count <= num_subrs; count++ )

View File

@ -196,6 +196,25 @@
memory = face->root.memory;
/* release subrs */
if ( face->subrs )
{
FT_Int n;
for ( n = 0; n < cid->num_dicts; n++ )
{
CID_Subrs* subr = face->subrs + n;
if ( subr->code )
{
FREE( subr->code[0] );
FREE( subr->code );
}
}
FREE( face->subrs );
}
/* release FontInfo strings */
FREE( info->version );
FREE( info->notice );

View File

@ -123,7 +123,7 @@
size->root.metrics.x_scale,
size->root.metrics.y_scale,
0, 0 );
return error;
return error;
}