aboutsummaryrefslogtreecommitdiff
path: root/cmd-new-window.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-07-21 12:01:16 +0100
committerThomas Adam <thomas@xteddy.org>2017-07-21 12:01:16 +0100
commite725b96a591ff269ad73946ac16b7f8fd3d0d2d9 (patch)
treeaca06ded5e5bd6d8f00922e304a0191f4a55c9ae /cmd-new-window.c
parentacbbc93501eea6732bdca3ca9f39589b867c6b68 (diff)
parent11e2af6df76e7384b4dcd20ea3b42ccba8e72310 (diff)
downloadrtmux-e725b96a591ff269ad73946ac16b7f8fd3d0d2d9.tar.gz
rtmux-e725b96a591ff269ad73946ac16b7f8fd3d0d2d9.tar.bz2
rtmux-e725b96a591ff269ad73946ac16b7f8fd3d0d2d9.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r--cmd-new-window.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c
index 82f1d745..7cb83f58 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -57,8 +57,8 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
struct winlink *wl = item->target.wl;
struct client *c = cmd_find_client(item, NULL, 1);
int idx = item->target.idx;
- const char *cmd, *path, *template, *cwd, *to_free;
- char **argv, *cause, *cp;
+ const char *cmd, *path, *template, *cwd;
+ char **argv, *cause, *cp, *to_free = NULL;
int argc, detached;
struct environ_entry *envent;
struct cmd_find_state fs;
@@ -93,10 +93,10 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
if (envent != NULL)
path = envent->value;
- to_free = NULL;
if (args_has(args, 'c')) {
cwd = args_get(args, 'c');
- to_free = cwd = format_single(item, cwd, c, s, NULL, NULL);
+ to_free = format_single(item, cwd, c, s, NULL, NULL);
+ cwd = to_free;
} else if (item->client != NULL && item->client->session == NULL)
cwd = item->client->cwd;
else
@@ -146,16 +146,13 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
free(cp);
}
- if (to_free != NULL)
- free((void *)to_free);
-
cmd_find_from_winlink(&fs, wl);
hooks_insert(s->hooks, item, &fs, "after-new-window");
+ free(to_free);
return (CMD_RETURN_NORMAL);
error:
- if (to_free != NULL)
- free((void *)to_free);
+ free(to_free);
return (CMD_RETURN_ERROR);
}