Do not use NULL active window; also do not leak window name. GitHub

issue 2590 from Chester Liu.
pull/2599/head
nicm 2021-03-02 11:00:38 +00:00
parent c44750792a
commit 81f9a23d25
2 changed files with 3 additions and 1 deletions

View File

@ -109,6 +109,8 @@ default_window_name(struct window *w)
{
char *cmd, *s;
if (w->active == NULL)
return (xstrdup(""));
cmd = cmd_stringify_argv(w->active->argc, w->active->argv);
if (cmd != NULL && *cmd != '\0')
s = parse_window_name(cmd);

View File

@ -184,7 +184,7 @@ spawn_window(struct spawn_context *sc, char **cause)
NULL);
options_set_number(w->options, "automatic-rename", 0);
} else
w->name = xstrdup(default_window_name(w));
w->name = default_window_name(w);
}
/* Switch to the new window if required. */