Dmitry Timoshkov : gdi32: Do not leak the hfont list (Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Feb 21 10:56:59 CST 2011


Module: wine
Branch: master
Commit: e0f5ddddf1a5f5d007576ef16d3221c0e178dc51
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e0f5ddddf1a5f5d007576ef16d3221c0e178dc51

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Mon Feb 21 18:21:46 2011 +0800

gdi32: Do not leak the hfont list (Valgrind).

---

 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);




More information about the wine-cvs mailing list