Juan Lang : user32: Return error if memory allocation fails. Fixes Coverity id 115.

Alexandre Julliard julliard at winehq.org
Thu Sep 11 08:00:18 CDT 2008


Module: wine
Branch: master
Commit: 1a5374065fe31e4a1363d5bd25c6e998d387e2a3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1a5374065fe31e4a1363d5bd25c6e998d387e2a3

Author: Juan Lang <juan.lang at gmail.com>
Date:   Wed Sep 10 10:14:13 2008 -0700

user32: Return error if memory allocation fails. Fixes Coverity id 115.

---

 dlls/user32/listbox.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index ee326c6..0c24e71 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -2658,6 +2658,8 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
             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
+                return LB_ERRSPACE;
         }
         wParam = LISTBOX_FindStringPos( descr, textW, FALSE );
         ret = LISTBOX_InsertString( descr, wParam, textW );
@@ -2682,6 +2684,8 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
             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
+                return LB_ERRSPACE;
         }
         ret = LISTBOX_InsertString( descr, wParam, textW );
         if(!unicode && HAS_STRINGS(descr))
@@ -2704,6 +2708,8 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
             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
+                return LB_ERRSPACE;
         }
         wParam = LISTBOX_FindFileStrPos( descr, textW );
         ret = LISTBOX_InsertString( descr, wParam, textW );




More information about the wine-cvs mailing list