From 1a5374065fe31e4a1363d5bd25c6e998d387e2a3 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Wed, 10 Sep 2008 10:14:13 -0700 Subject: [PATCH] user32: Return error if memory allocation fails. Fixes Coverity id 115. --- dlls/user32/listbox.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index ee326c69528..0c24e717f98 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 );