mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:37:12 +00:00
Do not use NULL active window; also do not leak window name. GitHub
issue 2590 from Chester Liu.
This commit is contained in:
2
names.c
2
names.c
@ -109,6 +109,8 @@ default_window_name(struct window *w)
|
|||||||
{
|
{
|
||||||
char *cmd, *s;
|
char *cmd, *s;
|
||||||
|
|
||||||
|
if (w->active == NULL)
|
||||||
|
return (xstrdup(""));
|
||||||
cmd = cmd_stringify_argv(w->active->argc, w->active->argv);
|
cmd = cmd_stringify_argv(w->active->argc, w->active->argv);
|
||||||
if (cmd != NULL && *cmd != '\0')
|
if (cmd != NULL && *cmd != '\0')
|
||||||
s = parse_window_name(cmd);
|
s = parse_window_name(cmd);
|
||||||
|
2
spawn.c
2
spawn.c
@ -184,7 +184,7 @@ spawn_window(struct spawn_context *sc, char **cause)
|
|||||||
NULL);
|
NULL);
|
||||||
options_set_number(w->options, "automatic-rename", 0);
|
options_set_number(w->options, "automatic-rename", 0);
|
||||||
} else
|
} else
|
||||||
w->name = xstrdup(default_window_name(w));
|
w->name = default_window_name(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch to the new window if required. */
|
/* Switch to the new window if required. */
|
||||||
|
Reference in New Issue
Block a user