CVSROOT:        /sources/freetype
Module name:    freetype2
Changes by:     David Turner <freetype> 06/06/07 05:11:51

Modified files:
        .              : ChangeLog 
        src/type1      : t1afm.c 

Log message:
          Fix memory leak described in Savannah bug #16768
        
          * src/type1/t1afm.c (T1_Read_Metrics): fix memory leak
          which happened when the metrics file doesn't have kerning
          pairs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/freetype2/ChangeLog?cvsroot=freetype&r1=1.1346&r2=1.1347
http://cvs.savannah.gnu.org/viewcvs/freetype2/src/type1/t1afm.c?cvsroot=freetype&r1=1.50&r2=1.51

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/freetype/freetype2/ChangeLog,v
retrieving revision 1.1346
retrieving revision 1.1347
diff -u -b -r1.1346 -r1.1347
--- ChangeLog   6 Jun 2006 12:54:08 -0000       1.1346
+++ ChangeLog   7 Jun 2006 05:11:50 -0000       1.1347
@@ -1,3 +1,11 @@
+2006-06-07  David Turner  <[EMAIL PROTECTED]>
+
+  Fix memory leak described in Savannah bug #16768
+
+  * src/type1/t1afm.c (T1_Read_Metrics): fix memory leak
+  which happened when the metrics file doesn't have kerning
+  pairs.
+
 2006-06-06  David Turner  <[EMAIL PROTECTED]>
 
        Fix memory leak described in Savannah bug #16759.

Index: src/type1/t1afm.c
===================================================================
RCS file: /sources/freetype/freetype2/src/type1/t1afm.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- src/type1/t1afm.c   20 Mar 2006 16:55:32 -0000      1.50
+++ src/type1/t1afm.c   7 Jun 2006 05:11:50 -0000       1.51
@@ -73,7 +73,7 @@
 
 
 #undef  KERN_INDEX
-#define KERN_INDEX( g1, g2 )  ( ( (FT_ULong)g1 << 16 ) | g2 )
+#define KERN_INDEX( g1, g2 )  ( ( (FT_ULong)(g1) << 16 ) | (g2) )
 
 
   /* compare two kerning pairs */
@@ -233,14 +233,9 @@
     T1_Font        t1_font = &( (T1_Face)t1_face )->type1;
 
 
-    if ( FT_NEW( fi ) )
-      return error;
-
-    if ( FT_FRAME_ENTER( stream->size ) )
-    {
-      FT_FREE( fi );
-      return error;
-    }
+    if ( FT_NEW( fi )                   ||
+         FT_FRAME_ENTER( stream->size ) )
+      goto Exit;
 
     fi->FontBBox  = t1_font->font_bbox;
     fi->Ascender  = t1_font->font_bbox.yMax;
@@ -292,11 +287,16 @@
       {
         t1_face->face_flags |= FT_FACE_FLAG_KERNING;
         ( (T1_Face)t1_face )->afm_data = fi;
+        fi = NULL;
       }
     }
 
     FT_FRAME_EXIT();
 
+  Exit:
+    if ( fi != NULL )
+      T1_Done_Metrics( memory, fi );
+
     return error;
   }
 


_______________________________________________
Freetype-cvs mailing list
Freetype-cvs@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-cvs

Reply via email to