Vincent Povirk : gdiplus: Don' t leak a device context when GdipCreateFromHWND fails.
Alexandre Julliard
julliard at winehq.org
Mon Apr 27 08:04:05 CDT 2009
Module: wine
Branch: master
Commit: c3d239566929879749a947f377e730d0fd0b859a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c3d239566929879749a947f377e730d0fd0b859a
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Fri Apr 24 13:34:55 2009 -0500
gdiplus: Don't leak a device context when GdipCreateFromHWND fails.
---
dlls/gdiplus/graphics.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index af3968c..36cb324 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -941,11 +941,17 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **gra
GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics)
{
GpStatus ret;
+ HDC hdc;
TRACE("(%p, %p)\n", hwnd, graphics);
- if((ret = GdipCreateFromHDC(GetDC(hwnd), graphics)) != Ok)
+ hdc = GetDC(hwnd);
+
+ if((ret = GdipCreateFromHDC(hdc, graphics)) != Ok)
+ {
+ ReleaseDC(hwnd, hdc);
return ret;
+ }
(*graphics)->hwnd = hwnd;
(*graphics)->owndc = TRUE;
More information about the wine-cvs
mailing list