[PATCH] user32: EM_REPLACESEL - handle OOM error

Marcus Meissner marcus at jet.franken.de
Wed Jan 6 09:52:46 CST 2010


Hi,

As we check for NULL return from HeapAlloc, we should also
handle it better and not let it crash 2 lines later.
(Or we could just remove the HeapAlloc return value check altogether.)

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

diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 20a853e..8fa15e8 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -4527,6 +4527,8 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
 		    INT countW = MultiByteToWideChar(CP_ACP, 0, textA, -1, NULL, 0);
 		    if((textW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
 			MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, countW);
+		    else
+			break;
 		}
 
 		EDIT_EM_ReplaceSel(es, (BOOL)wParam, textW, TRUE, TRUE);
-- 
1.5.6



More information about the wine-patches mailing list