diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2021-08-20 18:59:54 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2021-08-20 18:59:54 +0000 |
commit | c8b4b5f08ad924172f819d4e05271006e6447746 (patch) | |
tree | 4ce088a611f538a498f30175003784ce200fa995 /usr.bin/tmux/cmd-respawn-window.c | |
parent | 7945ba1cb9346b88267a4022df6945ee52e11e44 (diff) |
Expose args_value struct (will be needed soon) and add some missing frees.
Diffstat (limited to 'usr.bin/tmux/cmd-respawn-window.c')
-rw-r--r-- | usr.bin/tmux/cmd-respawn-window.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-respawn-window.c b/usr.bin/tmux/cmd-respawn-window.c index 39033bf26ba..e4887c32c88 100644 --- a/usr.bin/tmux/cmd-respawn-window.c +++ b/usr.bin/tmux/cmd-respawn-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-respawn-window.c,v 1.44 2020/04/13 20:51:57 nicm Exp $ */ +/* $OpenBSD: cmd-respawn-window.c,v 1.45 2021/08/20 18:59:53 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -54,8 +54,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item) struct session *s = target->s; struct winlink *wl = target->wl; char *cause = NULL; - const char *add; - struct args_value *value; + struct args_value *av; memset(&sc, 0, sizeof sc); sc.item = item; @@ -68,10 +67,10 @@ cmd_respawn_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 = -1; @@ -84,6 +83,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item) if (spawn_window(&sc, &cause) == NULL) { cmdq_error(item, "respawn window failed: %s", cause); free(cause); + environ_free(sc.environ); return (CMD_RETURN_ERROR); } |