diff options
author | 2021-03-02 11:00:38 +0000 | |
---|---|---|
committer | 2021-03-02 11:00:38 +0000 | |
commit | c6ae53936380970d43490a262e4af2fc1b12878d (patch) | |
tree | 868f312708860fbb6db47abbde131660df872fd8 | |
parent | finish GC old unintuitive interface (diff) | |
download | wireguard-openbsd-c6ae53936380970d43490a262e4af2fc1b12878d.tar.xz wireguard-openbsd-c6ae53936380970d43490a262e4af2fc1b12878d.zip |
Do not use NULL active window; also do not leak window name. GitHub
issue 2590 from Chester Liu.
-rw-r--r-- | usr.bin/tmux/names.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/spawn.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/names.c b/usr.bin/tmux/names.c index db826680878..01462c4778c 100644 --- a/usr.bin/tmux/names.c +++ b/usr.bin/tmux/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.43 2020/10/05 11:04:40 nicm Exp $ */ +/* $OpenBSD: names.c,v 1.44 2021/03/02 11:00:38 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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); diff --git a/usr.bin/tmux/spawn.c b/usr.bin/tmux/spawn.c index 5a03c5fa80c..d44420fa6e8 100644 --- a/usr.bin/tmux/spawn.c +++ b/usr.bin/tmux/spawn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spawn.c,v 1.26 2021/03/02 10:56:45 nicm Exp $ */ +/* $OpenBSD: spawn.c,v 1.27 2021/03/02 11:00:38 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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. */ |