diff --git a/reactos/dll/win32/user32/windows/paint.c b/reactos/dll/win32/user32/windows/paint.c index cf2de87c11e..62095932b69 100644 --- a/reactos/dll/win32/user32/windows/paint.c +++ b/reactos/dll/win32/user32/windows/paint.c @@ -149,7 +149,13 @@ SetWindowRgn( Hook = BeginIfHookedUserApiHook(); /* Bypass SEH and go direct. */ - if (!Hook) return (int)NtUserSetWindowRgn(hWnd, hRgn, bRedraw); + if (!Hook) + { + Ret = NtUserSetWindowRgn(hWnd, hRgn, bRedraw); + if (hRgn && Ret) + DeleteObject(hRgn); + return Ret; + } _SEH2_TRY {