freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 8336d53: [type42] Fix new memory leak.


From: Werner Lemberg
Subject: [freetype2] master 8336d53: [type42] Fix new memory leak.
Date: Sat, 12 Jun 2021 22:34:26 -0400 (EDT)

branch: master
commit 8336d53cff9f78bb48f1ba4aa670c1d8d81d1808
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [type42] Fix new memory leak.
    
    We need to inverse inheritance of FT_GlyphSlot_Internal so that we
    have a chance to free the rendered bitmap from the parent slot.
    
    * src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
    of the child `ttslot' and replace it with the parent structure.
    (T42_GlyphSlot_Done): Updated accordingly.
---
 ChangeLog            | 11 +++++++++++
 src/type42/t42objs.c |  8 ++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 07c9a78..80878ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2021-06-12  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+       [type42] Fix new memory leak.
+
+       We need to inverse inheritance of FT_GlyphSlot_Internal so that we
+       have a chance to free the rendered bitmap from the parent slot.
+
+       * src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
+       of the child `ttslot' and replace it with the parent structure.
+       (T42_GlyphSlot_Done): Updated accordingly.
+
 2021-06-12  Werner Lemberg  <wl@gnu.org>
 
        [psaux] Fix another assertion.
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index dd23e73..c32dc5b 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -600,9 +600,9 @@
     }
 
     /* share the loader so that the autohinter can see it */
-    FT_GlyphLoader_Done( t42slot->internal->loader );
-    FT_FREE( t42slot->internal );
-    t42slot->internal = slot->ttslot->internal;
+    FT_GlyphLoader_Done( slot->ttslot->internal->loader );
+    FT_FREE( slot->ttslot->internal );
+    slot->ttslot->internal = t42slot->internal;
 
     return error;
   }
@@ -614,8 +614,8 @@
     T42_GlyphSlot  slot = (T42_GlyphSlot)t42slot;
 
 
+    slot->ttslot->internal = NULL;
     FT_Done_GlyphSlot( slot->ttslot );
-    t42slot->internal = NULL;
   }
 
 



reply via email to

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