shithub: freetype+ttf2subf

Download patch

ref: 48f26bc74837146d4d71b717d9549a2b4aa4180c
parent: 620ec14955309c3cacc4e513bb4e287a38693c4a
author: Tom Kacvinsky <[email protected]>
date: Sat Oct 20 13:44:48 EDT 2001

In functions parse_font_name and parse_subrs, added a test for when
loading synthetic fonts to make sure that the font name and
subrotuines are not loaded twice.  This is to remove a memory leak
that occurs because the original allocation for these objects is not
deallocated when the objects are read the second time.

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -827,6 +827,9 @@
     FT_Byte*       cur2;
     FT_Byte*       limit;
 
+    if ( face->type1.font_name )
+      /*  with synthetic fonts, it's possible we get here twice  */
+      return;
 
     T1_Skip_Spaces( parser );
 
@@ -1095,6 +1098,9 @@
 
     PSAux_Interface*  psaux = (PSAux_Interface*)face->psaux;
 
+    if ( loader->num_subrs )
+      /*  with synthetic fonts, it's possible we get here twice  */
+      return;
 
     loader->num_subrs = T1_ToInt( parser );
     if ( parser->root.error )