Sven Baars : comctl32: Always free the tooltip text before setting it (Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Nov 25 09:12:28 CST 2019


Module: wine
Branch: stable
Commit: 8a6f5f958f71924db878a05620f93dfa89b8f99a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8a6f5f958f71924db878a05620f93dfa89b8f99a

Author: Sven Baars <sven.wine at gmail.com>
Date:   Sat May 18 18:49:51 2019 +0200

comctl32: Always free the tooltip text before setting it (Valgrind).

Signed-off-by: Sven Baars <sven.wine at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit d2b32bac5cf62d88b6297a054a4306a368ac94a2)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/comctl32/tooltips.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index 1aa55d12e3..b1e8f5147a 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -1660,6 +1660,13 @@ TOOLTIPS_SetToolInfoT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
     toolPtr->rect   = ti->rect;
     toolPtr->hinst  = ti->hinst;
 
+    if ( (toolPtr->lpszText) &&
+         !IS_INTRESOURCE(toolPtr->lpszText) ) {
+        if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
+            Free (toolPtr->lpszText);
+        toolPtr->lpszText = NULL;
+    }
+
     if (IS_INTRESOURCE(ti->lpszText)) {
 	TRACE("set string id %x\n", LOWORD(ti->lpszText));
 	toolPtr->lpszText = ti->lpszText;
@@ -1668,12 +1675,6 @@ TOOLTIPS_SetToolInfoT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
 	if (ti->lpszText == LPSTR_TEXTCALLBACKW)
 	    toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
 	else {
-	    if ( (toolPtr->lpszText) &&
-		 !IS_INTRESOURCE(toolPtr->lpszText) ) {
-		if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
-                    Free (toolPtr->lpszText);
-		toolPtr->lpszText = NULL;
-	    }
 	    if (ti->lpszText) {
 		if (isW) {
 		    INT len = lstrlenW (ti->lpszText);




More information about the wine-cvs mailing list