=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-new-window.c,v retrieving revision 1.70 retrieving revision 1.71 diff -c -r1.70 -r1.71 *** src/usr.bin/tmux/cmd-new-window.c 2017/04/22 10:22:39 1.70 --- src/usr.bin/tmux/cmd-new-window.c 2017/07/21 09:17:19 1.71 *************** *** 1,4 **** ! /* $OpenBSD: cmd-new-window.c,v 1.70 2017/04/22 10:22:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-new-window.c,v 1.71 2017/07/21 09:17:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 57,64 **** 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; int argc, detached; struct environ_entry *envent; struct cmd_find_state fs; --- 57,64 ---- 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; ! char **argv, *cause, *cp, *to_free = NULL; int argc, detached; struct environ_entry *envent; struct cmd_find_state fs; *************** *** 93,102 **** 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); } else if (item->client != NULL && item->client->session == NULL) cwd = item->client->cwd; else --- 93,102 ---- if (envent != NULL) path = envent->value; if (args_has(args, 'c')) { cwd = args_get(args, 'c'); ! 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,161 **** 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"); return (CMD_RETURN_NORMAL); error: ! if (to_free != NULL) ! free((void *)to_free); return (CMD_RETURN_ERROR); } --- 146,158 ---- free(cp); } cmd_find_from_winlink(&fs, wl); hooks_insert(s->hooks, item, &fs, "after-new-window"); + free(to_free); return (CMD_RETURN_NORMAL); error: ! free(to_free); return (CMD_RETURN_ERROR); }