[PATCH] comctl32/listview: Return earlier on allocation failure (Coverity)
Nikolay Sivov
nsivov at codeweavers.com
Thu Aug 4 02:57:47 CDT 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/comctl32/listview.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 6ab360b..cc1721b 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -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);
}
}
--
2.8.1
More information about the wine-patches
mailing list