diff --git a/windows/window.c b/windows/window.c index 3425a11f..137c5416 100644 --- a/windows/window.c +++ b/windows/window.c @@ -4748,8 +4748,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, static void wintw_set_title(TermWin *tw, const char *title) { sfree(window_name); - window_name = snewn(1 + strlen(title), char); - strcpy(window_name, title); + window_name = dupstr(title); if (conf_get_bool(conf, CONF_win_name_always) || !IsIconic(wgs.term_hwnd)) SetWindowText(wgs.term_hwnd, title); } @@ -4757,8 +4756,7 @@ static void wintw_set_title(TermWin *tw, const char *title) static void wintw_set_icon_title(TermWin *tw, const char *title) { sfree(icon_name); - icon_name = snewn(1 + strlen(title), char); - strcpy(icon_name, title); + icon_name = dupstr(title); if (!conf_get_bool(conf, CONF_win_name_always) && IsIconic(wgs.term_hwnd)) SetWindowText(wgs.term_hwnd, title); } diff --git a/windows/winnet.c b/windows/winnet.c index c548bc45..f607560e 100644 --- a/windows/winnet.c +++ b/windows/winnet.c @@ -550,8 +550,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, strncpy(realhost, host, sizeof(realhost)); } realhost[lenof(realhost)-1] = '\0'; - *canonicalname = snewn(1+strlen(realhost), char); - strcpy(*canonicalname, realhost); + *canonicalname = dupstr(realhost); return ret; }