ref: dddd068e5dc398c290ca5b559c1ce5622b5d667f
parent: 91aaf3267bf35af8ad601edc57caf751e5266d2d
author: David Turner <[email protected]>
date: Mon Mar 5 13:23:25 EST 2007
fix a small memory leak when FT_Init_FreeType fails for some reason
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2007-03-05 David Turner <[email protected]>
+ * 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
clear the x_ppem and y_ppem fields of the TT_Size.metrics structure,
note those of TT_Size.root.metrics. duh !!
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -124,7 +124,11 @@
/* default drivers. */
error = FT_New_Library( memory, alibrary );
- if ( !error )
+ if (error)
+ {
+ FT_Done_Memory(memory);
+ }
+ else
{
(*alibrary)->version_major = FREETYPE_MAJOR;
(*alibrary)->version_minor = FREETYPE_MINOR;