From 85f7db906b0f81051f616d2839d737ec066d8698 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 9 Oct 2017 06:48:36 +0200 Subject: [PATCH] Status bar tooltip creation functions now set the tooltip pointer to NULL after free'ing it. --- src/win/win_stbar.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index b2491d98f..eccc45d73 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -313,8 +313,10 @@ StatusBarCreateFloppyTip(int part) drive+1, wtext, floppyfns[drive]); } - if (sbTips[part] != NULL) + if (sbTips[part] != NULL) { free(sbTips[part]); + sbTips[part] = NULL; + } sbTips[part] = (WCHAR *) malloc((wcslen(tempTip) << 1) + 2); wcscpy(sbTips[part], tempTip); } @@ -346,8 +348,10 @@ StatusBarCreateCdromTip(int part) _swprintf(tempTip, win_get_string(IDS_5120), drive + 1, szText, win_get_string(IDS_2057)); } - if (sbTips[part] != NULL) + if (sbTips[part] != NULL) { free(sbTips[part]); + sbTips[part] = NULL; + } sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2); wcscpy(sbTips[part], tempTip); } @@ -365,8 +369,10 @@ StatusBarCreateRemovableDiskTip(int part) _swprintf(tempTip, win_get_string(IDS_4115), drive, hdd[drive].fn); } - if (sbTips[part] != NULL) + if (sbTips[part] != NULL) { free(sbTips[part]); + sbTips[part] = NULL; + } sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2); wcscpy(sbTips[part], tempTip); }