user32/edit : small memory leak fixed

pquiring at gmail.com pquiring at gmail.com
Sat Dec 17 11:20:54 CST 2011


After trying to fix the recent EDIT control regressions I found a small memory 
leak.
In the section of code the org coder wanted to reset the region but just 
allocated a new one instead of deleting the old one and settings it to NULL.

---
 dlls/user32/edit.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 0ceb8cf..8b1b812 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -2582,7 +2582,8 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL 
can_undo, LPCWSTR lpsz_replac
 				abs(es->selection_end - es->selection_start) - strl, hrgn);
 			strl = 0;
 			e = s;
-			hrgn = CreateRectRgn(0, 0, 0, 0);
+			DeleteObject(hrgn);
+			hrgn = NULL;
 			EDIT_NOTIFY_PARENT(es, EN_MAXTEXT);
 		}
 	}
-- 
1.7.5.4

Peter Quiring



More information about the wine-patches mailing list