=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: shell32/autocomplete: Handle heap_alloc failure.

Alexandre Julliard julliard at winehq.org
Tue Sep 11 14:53:19 CDT 2018


Module: wine
Branch: master
Commit: 97006eb6619e27edabd4ab2c8181207e10c09ca6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=97006eb6619e27edabd4ab2c8181207e10c09ca6

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Mon Sep 10 22:09:32 2018 +0300

shell32/autocomplete: Handle heap_alloc failure.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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));




More information about the wine-cvs mailing list