[PATCH 1/2] Added logic to eliminate a valgrind warning in

Michael James james.me at gmail.com
Sun Jan 25 22:09:33 CST 2009


LISTVIEW_GetItemExtT

The original code used correct but somewhat obscure logic.  Added a test to
avoid testing uninitialized pointer for pszText when LVIF_TEXT is not indicated
in the flags.  With this change, the code functions identically to what it was
doing before but will not cause a warning from valgrind.
---
 dlls/comctl32/listview.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 172925f..f28a70e 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -5685,7 +5685,7 @@ static BOOL LISTVIEW_GetItemExtT(const
LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVIte

     pszText = lpLVItem->pszText;
     bResult = LISTVIEW_GetItemT(infoPtr, lpLVItem, isW);
-    if (bResult && lpLVItem->pszText != pszText)
+    if (bResult && (lpLVItem->mask & LVIF_TEXT) && lpLVItem->pszText
!= pszText)
        textcpynT(pszText, isW, lpLVItem->pszText, isW, lpLVItem->cchTextMax);
     lpLVItem->pszText = pszText;

-- 
1.6.1



More information about the wine-patches mailing list