[PATCH 4/5] comdlg32: Fix a memory leak.

Zhiyi Zhang zzhang at codeweavers.com
Sun Feb 28 21:10:02 CST 2021


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/comdlg32/colordlg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/comdlg32/colordlg.c b/dlls/comdlg32/colordlg.c
index 7ab5efd0962..d5254736b24 100644
--- a/dlls/comdlg32/colordlg.c
+++ b/dlls/comdlg32/colordlg.c
@@ -523,6 +523,7 @@ static void CC_PaintCross(CCPRIV *infoPtr)
    int wc = GetDialogBaseUnits() * 3 / 4;
    RECT rect;
    POINT point, p;
+   HRGN region;
    HPEN hPen;
    int x, y;
 
@@ -531,7 +532,9 @@ static void CC_PaintCross(CCPRIV *infoPtr)
 
    GetClientRect(hwnd, &rect);
    hDC = GetDC(hwnd);
-   SelectClipRgn( hDC, CreateRectRgnIndirect(&rect));
+   region = CreateRectRgnIndirect(&rect);
+   SelectClipRgn(hDC, region);
+   DeleteObject(region);
 
    point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
    point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
-- 
2.27.0




More information about the wine-devel mailing list