Module: wine Branch: master Commit: 4cafd76f2ddba6830a8e155dce3a1157b57bc347 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4cafd76f2ddba6830a8e155dce...
Author: Joris Huizer jorishuizer@debian Date: Thu Jun 26 22:13:29 2008 +0200
gdiplus: font: Ensure to release resources.
---
dlls/gdiplus/font.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 0bb9fc7..4b784f6 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -42,6 +42,7 @@ static inline REAL get_dpi (void) HDC hdc = GetDC(0); GdipCreateFromHDC (hdc, &graphics); GdipGetDpiX(graphics, &dpi); + GdipDeleteGraphics(graphics); ReleaseDC (0, hdc);
return dpi; @@ -351,7 +352,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, { GpFontFamily* ffamily; HDC hdc; - HFONT hFont; + HFONT hFont, hfont_old; LOGFONTW lfw;
TRACE("%s, %p %p\n", debugstr_w(name), fontCollection, FontFamily); @@ -371,14 +372,17 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, hdc = GetDC(0); lstrcpynW(lfw.lfFaceName, name, sizeof(WCHAR) * LF_FACESIZE); hFont = CreateFontIndirectW (&lfw); - SelectObject(hdc, hFont); + hfont_old = SelectObject(hdc, hFont);
GetTextMetricsW(hdc, ffamily->tmw); + DeleteObject(SelectObject(hdc, hfont_old));
ffamily->FamilyName = GdipAlloc(LF_FACESIZE * sizeof (WCHAR)); if (!ffamily->FamilyName) { + GdipFree(ffamily->tmw); GdipFree(ffamily); + ReleaseDC(0, hdc); return OutOfMemory; }