comctl32/listview: Return earlier on allocation failure (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-08-04 10:57:47 +03:00 committed by Alexandre Julliard
parent 42cc080f8c
commit 622a24046f
1 changed files with 8 additions and 6 deletions

View File

@ -5863,13 +5863,15 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
{
DWORD len = isW ? GetWindowTextLengthW(infoPtr->hwndEdit) : GetWindowTextLengthA(infoPtr->hwndEdit);
if (len)
if (len++)
{
if ((pszText = Alloc((len+1) * (isW ? sizeof(WCHAR) : sizeof(CHAR)))))
{
if (isW) GetWindowTextW(infoPtr->hwndEdit, pszText, len+1);
else GetWindowTextA(infoPtr->hwndEdit, (CHAR*)pszText, len+1);
}
if (!(pszText = Alloc(len * (isW ? sizeof(WCHAR) : sizeof(CHAR)))))
return FALSE;
if (isW)
GetWindowTextW(infoPtr->hwndEdit, pszText, len);
else
GetWindowTextA(infoPtr->hwndEdit, (CHAR*)pszText, len);
}
}