From 25d66de3588f96a0442dd6dada2cf972949fa596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Zalewski?= Date: Sat, 13 May 2006 21:16:41 +0200 Subject: [PATCH] comctl32 header: Free the old string also when the new one is LPSTR_TEXTCALLBACK. --- dlls/comctl32/header.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index 7d0aeb50ae1..bed77cae553 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c @@ -131,17 +131,16 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, HDITEMW *phdi, BOOL if (phdi->mask & HDI_TEXT) { + if (lpItem->pszText) + { + if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW) + Free(lpItem->pszText); + lpItem->pszText = NULL; + } + if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */ { - LPWSTR pszText; - if (lpItem->pszText) - { - if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW) - Free(lpItem->pszText); - lpItem->pszText = NULL; - } - - pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString); + LPWSTR pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString); if (fUnicode) Str_SetPtrW(&lpItem->pszText, pszText); else