]> git.imager.perl.org - imager.git/commitdiff
Fixed memory leak in freetype 1 cache.
authorArnar Mar Hrafnkelsson <addi@cpan.org>
Sun, 31 Mar 2002 05:42:14 +0000 (05:42 +0000)
committerArnar Mar Hrafnkelsson <addi@cpan.org>
Sun, 31 Mar 2002 05:42:14 +0000 (05:42 +0000)
font.c

diff --git a/font.c b/font.c
index 60d222adf9eb3bbe2d1dfd21d8af01bb4092a788..35d333d1a235f77fe05a33d0223a25365abdab0e 100644 (file)
--- a/font.c
+++ b/font.c
@@ -486,7 +486,15 @@ i_tt_get_instance( TT_Fonthandle *handle, int points, int smooth ) {
   
   if ( USTRCT(handle->instanceh[idx].instance) ) {
     mm_log((1,"i_tt_get_instance: freeing lru item from cache %d\n",idx));
+    /* Free cached glyphs */
+
+    for(i=0;i<256;i++)
+      if ( USTRCT(handle->instanceh[idx].glyphs[i]) )
+       TT_Done_Glyph( handle->instanceh[idx].glyphs[i] );
+
+    for(i=0;i<256;i++) USTRCT(handle->instanceh[idx].glyphs[i])=NULL;    
     TT_Done_Instance( handle->instanceh[idx].instance ); /* Free instance if needed */
+    
   }
   
   /* create and initialize instance */