Mikołaj Zalewski : comctl32 header: Free the old string also when the new one is LPSTR_TEXTCALLBACK.

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 15 09:42:29 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 25d66de3588f96a0442dd6dada2cf972949fa596
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=25d66de3588f96a0442dd6dada2cf972949fa596

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Sat May 13 21:16:41 2006 +0200

comctl32 header: Free the old string also when the new one is LPSTR_TEXTCALLBACK.

---

 dlls/comctl32/header.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index 7d0aeb5..bed77ca 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -131,17 +131,16 @@ static void HEADER_StoreHDItemInHeader(H
 
     if (phdi->mask & HDI_TEXT)
     {
-        if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
+        if (lpItem->pszText)
         {
-            LPWSTR pszText;
-            if (lpItem->pszText)
-            {
-                if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW)
-                    Free(lpItem->pszText);
-                lpItem->pszText = NULL;
-            }
+            if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW)
+                Free(lpItem->pszText);
+            lpItem->pszText = NULL;
+        }
 
-            pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString);
+        if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
+        {
+            LPWSTR pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString);
             if (fUnicode)
                 Str_SetPtrW(&lpItem->pszText, pszText);
             else




More information about the wine-cvs mailing list