[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetype-devel
Subject:    [ft-devel] A possible fix for potential memory leak in
From:       "Liang Qi" <cavendish.qi () gmail ! com>
Date:       2008-12-12 13:43:15
Message-ID: 5dff417c0812120543g2e0b3540xc26d64f58888225a () mail ! gmail ! com
[Download RAW message or body]

Hi,

In freetype 2.3.7, FT_GlyphSlot_Own_Bitmap does not release the old
bitmap resource. Then I give a possible patch for it.

And I have some other questions about FT_GlyphSlot_Embolden(),

In include/freetype/ftsynth.h
  /* Do not use this function directly!  Copy the code to */
  /* your application and modify it to suit your need.    */
  FT_EXPORT( void )
  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );

And in FT_GlyphSlot_Embolden, it calls FT_GlyphSlot_Own_Bitmap, but
there are some internal calls in FT_GlyphSlot_Own_Bitmap, such as
FT_SLOT_FACE and FT_PIX_FLOOR(they marcos).

I just want to make sure whether now FT_GlyphSlot_Embolden() is stable
enough or not. Is seemed many toolkits for CJK fonts depend on this
API. And some distributions didn't provide this API just because of
this notice. Any suggestion on this topic? Thanks a lot.

Best Regards,
Liang Qi

["freetype-2.3.7-fix-embolden-memory-leak.patch" (text/x-patch)]

--- src/base/ftsynth.c.old	2006-11-07 10:38:57.000000000 +0100
+++ src/base/ftsynth.c	2008-12-12 14:31:53.000000000 +0100
@@ -83,6 +83,10 @@
       if ( error )
         return error;
 
+      error = FT_Bitmap_Done( slot->library, &slot->bitmap );
+      if ( error )
+        return error;
+
       slot->bitmap = bitmap;
       slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
     }


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic