[PATCH v4 02/10] shell32/autocomplete: Handle heap_alloc failure
Gabriel Ivăncescu
gabrielopcode at gmail.com
Mon Sep 10 14:09:32 CDT 2018
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/shell32/autocomplete.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 587d41f..6a77ddb 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -210,7 +210,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
int len;
len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, 0);
- msg = heap_alloc((len + 1)*sizeof(WCHAR));
+ if (!(msg = heap_alloc((len + 1) * sizeof(WCHAR))))
+ return 0;
SendMessageW(This->hwndListBox, LB_GETTEXT, sel, (LPARAM)msg);
SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)msg);
SendMessageW(hwnd, EM_SETSEL, lstrlenW(msg), lstrlenW(msg));
@@ -329,7 +330,8 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
if (sel < 0)
break;
len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, 0);
- msg = heap_alloc((len + 1)*sizeof(WCHAR));
+ if (!(msg = heap_alloc((len + 1) * sizeof(WCHAR))))
+ break;
SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg);
SendMessageW(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg);
SendMessageW(This->hwndEdit, EM_SETSEL, 0, lstrlenW(msg));
--
1.9.1
More information about the wine-devel
mailing list