Huw Davies : gdi32: Add a helper to free a face object and fix a potential memory leak.
Alexandre Julliard
julliard at winehq.org
Tue Mar 27 12:48:06 CDT 2012
Module: wine
Branch: master
Commit: 8d50bb6711e3e3e3cc0bfd56ad15aafa2ef712a3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8d50bb6711e3e3e3cc0bfd56ad15aafa2ef712a3
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Mar 27 11:48:45 2012 +0100
gdi32: Add a helper to free a face object and fix a potential memory leak.
---
dlls/gdi32/freetype.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index be03c34..efa36bb 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -1668,6 +1668,15 @@ static inline void get_fontsig( FT_Face ft_face, FONTSIGNATURE *fs )
}
}
+static inline void free_face( Face *face )
+{
+ HeapFree( GetProcessHeap(), 0, face->file );
+ HeapFree( GetProcessHeap(), 0, face->StyleName );
+ HeapFree( GetProcessHeap(), 0, face->FullName );
+ HeapFree( GetProcessHeap(), 0, face->cached_enum_data );
+ HeapFree( GetProcessHeap(), 0, face );
+}
+
#define ADDFONT_EXTERNAL_FONT 0x01
#define ADDFONT_FORCE_BITMAP 0x02
#define ADDFONT_ADD_TO_CACHE 0x04
@@ -1709,10 +1718,7 @@ static void AddFaceToList(FT_Face ft_face, const char *file, void *font_data_ptr
} else {
TRACE("Replacing original with this one\n");
list_remove(&face->entry);
- HeapFree(GetProcessHeap(), 0, face->file);
- HeapFree(GetProcessHeap(), 0, face->StyleName);
- HeapFree(GetProcessHeap(), 0, face->FullName);
- HeapFree(GetProcessHeap(), 0, face);
+ free_face( face );
break;
}
}
More information about the wine-cvs
mailing list