Commit 3d507fefe822ad598b7a47f1561ee1ff2782ce37

Werner Lemberg 2007-06-03T16:54:55

* src/base/ftobjs.c (destroy_charmaps), src/type1/t1objs.c (T1_Face_Done), src/winfonts/winfnt.c (FNT_Face_Done): Check for face == NULL. Suggested by Graham Asher.

diff --git a/ChangeLog b/ChangeLog
index f0c3119..1725a71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-06-03  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftobjs.c (destroy_charmaps), src/type1/t1objs.c
+	(T1_Face_Done), src/winfonts/winfnt.c (FNT_Face_Done): Check for
+	face == NULL.  Suggested by Graham Asher.
+
 2007-06-03  Ismail Dönmez  <ismail@pardus.org.tr>
 
 	* src/base/ftobjs.c (FT_Request_Metrics): Fix compiler warning.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 4d3de71..fa08094 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -787,6 +787,9 @@
     FT_Int  n;
 
 
+    if ( !face )
+      return;
+
     for ( n = 0; n < face->num_charmaps; n++ )
     {
       FT_CMap  cmap = FT_CMAP( face->charmaps[n] );
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 095e7f1..3d08336 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 objects manager (body).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -191,13 +191,11 @@
   FT_LOCAL_DEF( void )
   T1_Face_Done( T1_Face  face )
   {
-    FT_Memory  memory;
-    T1_Font    type1 = &face->type1;
-
-
     if ( face )
     {
-      memory = face->root.memory;
+      FT_Memory  memory = face->root.memory;
+      T1_Font    type1  = &face->type1;
+
 
 #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
       /* release multiple masters information */
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index d3d6024..d0251cf 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -386,13 +386,16 @@
   static void
   FNT_Face_Done( FNT_Face  face )
   {
-    FT_Memory  memory = FT_FACE_MEMORY( face );
+    if ( face )
+    {
+      FT_Memory  memory = FT_FACE_MEMORY( face );
 
 
-    fnt_font_done( face );
+      fnt_font_done( face );
 
-    FT_FREE( face->root.available_sizes );
-    face->root.num_fixed_sizes = 0;
+      FT_FREE( face->root.available_sizes );
+      face->root.num_fixed_sizes = 0;
+    }
   }