[3/3] gdi32: Do not leak the hfont list (Valgrind).

Dmitry Timoshkov dmitry at codeweavers.com
Mon Feb 21 04:21:46 CST 2011


---
 dlls/gdi32/freetype.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index edddde1..506c994 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -3086,20 +3086,20 @@ static void free_font(GdiFont *font)
     LIST_FOR_EACH_SAFE(cursor, cursor2, &font->child_fonts)
     {
         CHILD_FONT *child = LIST_ENTRY(cursor, CHILD_FONT, entry);
-        struct list *first_hfont;
-        HFONTLIST *hfontlist;
         list_remove(cursor);
         if(child->font)
-        {
-            first_hfont = list_head(&child->font->hfontlist);
-            hfontlist = LIST_ENTRY(first_hfont, HFONTLIST, entry);
-            DeleteObject(hfontlist->hfont);
-            HeapFree(GetProcessHeap(), 0, hfontlist);
             free_font(child->font);
-        }
         HeapFree(GetProcessHeap(), 0, child);
     }
 
+    LIST_FOR_EACH_SAFE(cursor, cursor2, &font->hfontlist)
+    {
+        HFONTLIST *hfontlist = LIST_ENTRY(cursor, HFONTLIST, entry);
+        DeleteObject(hfontlist->hfont);
+        list_remove(&hfontlist->entry);
+        HeapFree(GetProcessHeap(), 0, hfontlist);
+    }
+
     if (font->ft_face) pFT_Done_Face(font->ft_face);
     if (font->mapping) unmap_font_file( font->mapping );
     HeapFree(GetProcessHeap(), 0, font->kern_pairs);
-- 
1.7.3.5




More information about the wine-patches mailing list