freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] ftmac.c double free bug


From: Torrey Lyons
Subject: [Devel] ftmac.c double free bug
Date: Tue, 8 Apr 2003 16:49:42 -0700

There is a bug in ftmac.c which causes a double free of memory when a face fails to open. A patch to fix this is:

Index: ftmac.c
===================================================================
RCS file: /home/x-cvs/xc/extras/freetype2/src/base/ftmac.c,v
retrieving revision 1.2
diff -u -d -b -w -r1.2 ftmac.c
--- ftmac.c     2003/01/01 22:08:40     1.2
+++ ftmac.c     2003/04/08 23:43:33
@@ -545,11 +545,6 @@
     error = FT_Open_Face( library, &args, face_index, aface );
     if ( error == FT_Err_Ok )
       (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
-    else
-    {
-      FT_Stream_CloseFunc( stream );
-      FT_FREE( stream );
-    }

     return error;
   }

The problem is that FT_Open_Face() already frees the stream with FT_Stream_CloseFunc() and FT_FREE() if there is an error, so we should not be doing it here as well.

--Torrey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]