summaryrefslogtreecommitdiffstats
path: root/cmd-respawn-window.c
diff options
context:
space:
mode:
authornicm <nicm>2021-08-20 18:59:53 +0000
committernicm <nicm>2021-08-20 18:59:53 +0000
commit90dd474c3ea8bf10bde6ee15eaaf9f3af3fb46f6 (patch)
treed7a208a65eaa5d17da7f7b764cfcf94ebfe01366 /cmd-respawn-window.c
parent6cbc83c6a64f272575aac1ee32cc0a0b1cb75c7b (diff)
Expose args_value struct (will be needed soon) and add some missing frees.
Diffstat (limited to 'cmd-respawn-window.c')
-rw-r--r--cmd-respawn-window.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index 39d19ddb..da3ecee4 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -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);
}