fix a small memory leak when FT_Init_FreeType fails for some reason

This commit is contained in:
David Turner 2007-03-05 18:23:25 +00:00
parent 91aaf3267b
commit dddd068e5d
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2007-03-05 David Turner <david@freetype.org> 2007-03-05 David Turner <david@freetype.org>
* src/base/ftinit.c (FT_Init_FreeType): fixed a small memory leak
when FT_Init_FreeType fails for some reason
* src/truetype/ttobs.c (tt_size_init_bytecode): bugfix, we need to * src/truetype/ttobs.c (tt_size_init_bytecode): bugfix, we need to
clear the x_ppem and y_ppem fields of the TT_Size.metrics structure, clear the x_ppem and y_ppem fields of the TT_Size.metrics structure,
note those of TT_Size.root.metrics. duh !! note those of TT_Size.root.metrics. duh !!

View File

@ -124,7 +124,11 @@
/* default drivers. */ /* default drivers. */
error = FT_New_Library( memory, alibrary ); error = FT_New_Library( memory, alibrary );
if ( !error ) if (error)
{
FT_Done_Memory(memory);
}
else
{ {
(*alibrary)->version_major = FREETYPE_MAJOR; (*alibrary)->version_major = FREETYPE_MAJOR;
(*alibrary)->version_minor = FREETYPE_MINOR; (*alibrary)->version_minor = FREETYPE_MINOR;