Commit c3d23956 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Don't leak a device context when GdipCreateFromHWND fails.

parent 8a3d9ff7
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment