diff options
author | nicm <nicm> | 2021-08-20 18:59:53 +0000 |
---|---|---|
committer | nicm <nicm> | 2021-08-20 18:59:53 +0000 |
commit | 90dd474c3ea8bf10bde6ee15eaaf9f3af3fb46f6 (patch) | |
tree | d7a208a65eaa5d17da7f7b764cfcf94ebfe01366 /cmd-new-window.c | |
parent | 6cbc83c6a64f272575aac1ee32cc0a0b1cb75c7b (diff) | |
download | rtmux-90dd474c3ea8bf10bde6ee15eaaf9f3af3fb46f6.tar.gz rtmux-90dd474c3ea8bf10bde6ee15eaaf9f3af3fb46f6.tar.bz2 rtmux-90dd474c3ea8bf10bde6ee15eaaf9f3af3fb46f6.zip |
Expose args_value struct (will be needed soon) and add some missing frees.
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r-- | cmd-new-window.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c index 712e2a79..9393f6e4 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -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) { |