Module: wine Branch: master Commit: 92a8c691948118906e2604c1f243a5ca6d8c5cad URL: https://source.winehq.org/git/wine.git/?a=commit;h=92a8c691948118906e2604c1f...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Mon Mar 1 11:09:55 2021 +0800
user32: Fix memory leaks.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/edit.c | 2 +- dlls/user32/nonclient.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 515341f65ea..4de206aa12f 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -2633,7 +2633,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r abs(es->selection_end - es->selection_start) - strl, hrgn); strl = 0; e = s; - hrgn = CreateRectRgn(0, 0, 0, 0); + SetRectRgn(hrgn, 0, 0, 0, 0); EDIT_NOTIFY_PARENT(es, EN_MAXTEXT); } } diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 8cfd3c0d371..e56c03deaf0 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -976,7 +976,11 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip ) hdc = GetDCEx( hwnd, hrgn, DCX_USESTYLE | DCX_WINDOW | DCX_EXCLUDERGN ); }
- if (!hdc) return; + if (!hdc) + { + DeleteObject( hrgn ); + return; + }
WIN_GetRectangles( hwnd, COORDS_WINDOW, &rect, NULL ); GetClipBox( hdc, &rectClip );