On Thu, Jun 26, 2008 at 02:05:15AM -0700, Joris Huizer wrote:
Untested, but this seems trivial/obvious, unless I overlooked something
From 4026f68e4404c4b1822eefe0b3419db4f896e055 Mon Sep 17 00:00:00 2001 From: Joris Huizer <jorishuizer@debian.(none)> Date: Thu, 26 Jun 2008 11:07:11 +0200 Subject: [PATCH] memory leak fix
dlls/gdiplus/font.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 0bb9fc7..9ef8edc 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -378,6 +378,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, ffamily->FamilyName = GdipAlloc(LF_FACESIZE * sizeof (WCHAR)); if (!ffamily->FamilyName) {
}GdipFree(ffamily->tmw); GdipFree(ffamily); return OutOfMemory;
That's a good start, but there's more. The function leaks an hfont both on success and in this failure case. Also there should be a ReleaseDC in the failure case.
In addition it seems to me that the tmw element may as well be an embedded structure rather than a structure pointer. That'll save having to worry about alloc'ing/free'ing it.
Huw.