summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-new-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-08-20 18:59:54 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-08-20 18:59:54 +0000
commitc8b4b5f08ad924172f819d4e05271006e6447746 (patch)
tree4ce088a611f538a498f30175003784ce200fa995 /usr.bin/tmux/cmd-new-window.c
parent7945ba1cb9346b88267a4022df6945ee52e11e44 (diff)
Expose args_value struct (will be needed soon) and add some missing frees.
Diffstat (limited to 'usr.bin/tmux/cmd-new-window.c')
-rw-r--r--usr.bin/tmux/cmd-new-window.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c
index d74ce0fef5c..de34fbbefdd 100644
--- a/usr.bin/tmux/cmd-new-window.c
+++ b/usr.bin/tmux/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-window.c,v 1.90 2021/02/05 12:23:49 nicm Exp $ */
+/* $OpenBSD: cmd-new-window.c,v 1.91 2021/08/20 18:59:53 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -62,9 +62,9 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
int idx = target->idx, before;
struct winlink *new_wl = NULL;
char *cause = NULL, *cp;
- const char *template, *add, *name;
+ const char *template, *name;
struct cmd_find_state fs;
- struct args_value *value;
+ struct args_value *av;
/*
* If -S and -n are given and -t is not and a single window with this
@@ -112,10 +112,10 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
sc.argv = args->argv;
sc.environ = environ_create();
- add = args_first_value(args, 'e', &value);
- while (add != NULL) {
- environ_put(sc.environ, add, 0);
- add = args_next_value(&value);
+ av = args_first_value(args, 'e');
+ while (av != NULL) {
+ environ_put(sc.environ, av->value, 0);
+ av = args_next_value(av);
}
sc.idx = idx;
@@ -130,6 +130,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
if ((new_wl = spawn_window(&sc, &cause)) == NULL) {
cmdq_error(item, "create window failed: %s", cause);
free(cause);
+ environ_free(sc.environ);
return (CMD_RETURN_ERROR);
}
if (!args_has(args, 'd') || new_wl == s->curw) {