From 6e719efbe968ae0cd22a72b91b2bcabaf37fdd06 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 27 May 2007 12:48:45 +0000 Subject: [PATCH] fix region leak svn path=/trunk/; revision=26920 --- reactos/subsystems/win32/win32k/ntuser/painting.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/painting.c b/reactos/subsystems/win32/win32k/ntuser/painting.c index 1b43e12d3cb..af0b4262f47 100644 --- a/reactos/subsystems/win32/win32k/ntuser/painting.c +++ b/reactos/subsystems/win32/win32k/ntuser/painting.c @@ -166,27 +166,34 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate) Window->UpdateRegion != (HRGN)1) { hRgnNonClient = NtGdiCreateRectRgn(0, 0, 0, 0); - hRgnWindow = IntCalcWindowRgn(Window, TRUE); /* * If region creation fails it's safe to fallback to whole * window region. */ - if (hRgnNonClient == NULL) { return (HRGN)1; } + hRgnWindow = IntCalcWindowRgn(Window, TRUE); + if (hRgnWindow == NULL) + { + NtGdiDeleteObject(hRgnNonClient); + return (HRGN)1; + } + RgnType = NtGdiCombineRgn(hRgnNonClient, Window->UpdateRegion, hRgnWindow, RGN_DIFF); if (RgnType == ERROR) { + NtGdiDeleteObject(hRgnWindow); NtGdiDeleteObject(hRgnNonClient); return (HRGN)1; } else if (RgnType == NULLREGION) { + NtGdiDeleteObject(hRgnWindow); NtGdiDeleteObject(hRgnNonClient); return NULL; }