Nikolay Sivov : user32/edit: Properly clean up on failure inside WM_NCCREATE handler.
Alexandre Julliard
julliard at winehq.org
Wed Oct 21 13:14:05 CDT 2009
Module: wine
Branch: master
Commit: e72ed1c42123b0b1b6dc6a0eaae7e80215199927
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e72ed1c42123b0b1b6dc6a0eaae7e80215199927
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue Oct 20 21:56:44 2009 +0400
user32/edit: Properly clean up on failure inside WM_NCCREATE handler.
---
dlls/user32/edit.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 437862b..38622cc 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -4599,16 +4599,16 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
alloc_size = ROUND_TO_GROW((es->buffer_size + 1) * sizeof(WCHAR));
if(!(es->hloc32W = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, alloc_size)))
- return FALSE;
+ goto cleanup;
es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1;
if (!(es->undo_text = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (es->buffer_size + 1) * sizeof(WCHAR))))
- return FALSE;
+ goto cleanup;
es->undo_buffer_size = es->buffer_size;
if (es->style & ES_MULTILINE)
if (!(es->first_line_def = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINEDEF))))
- return FALSE;
+ goto cleanup;
es->line_count = 1;
/*
@@ -4628,6 +4628,14 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
SetWindowLongW(hwnd, GWL_STYLE, es->style & ~WS_BORDER);
return TRUE;
+
+cleanup:
+ SetWindowLongPtrW(es->hwndSelf, 0, 0);
+ HeapFree(GetProcessHeap(), 0, es->first_line_def);
+ HeapFree(GetProcessHeap(), 0, es->undo_text);
+ if (es->hloc32W) LocalFree(es->hloc32W);
+ HeapFree(GetProcessHeap(), 0, es);
+ return FALSE;
}
More information about the wine-cvs
mailing list