=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-new-session.c,v retrieving revision 1.74 retrieving revision 1.75 diff -c -r1.74 -r1.75 *** src/usr.bin/tmux/cmd-new-session.c 2015/10/27 15:58:42 1.74 --- src/usr.bin/tmux/cmd-new-session.c 2015/10/28 09:51:55 1.75 *************** *** 1,4 **** ! /* $OpenBSD: cmd-new-session.c,v 1.74 2015/10/27 15:58:42 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-new-session.c,v 1.75 2015/10/28 09:51:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 60,66 **** struct client *c = cmdq->client, *c0; struct session *s, *groupwith; struct window *w; ! struct environ env; struct termios tio, *tiop; const char *newname, *target, *update, *errstr, *template; const char *path; --- 60,66 ---- struct client *c = cmdq->client, *c0; struct session *s, *groupwith; struct window *w; ! struct environ *env; struct termios tio, *tiop; const char *newname, *target, *update, *errstr, *template; const char *path; *************** *** 223,252 **** path = NULL; if (c != NULL && c->session == NULL) ! envent = environ_find(&c->environ, "PATH"); else ! envent = environ_find(&global_environ, "PATH"); if (envent != NULL) path = envent->value; /* Construct the environment. */ ! environ_init(&env); if (c != NULL && !args_has(args, 'E')) { update = options_get_string(global_s_options, "update-environment"); ! environ_update(update, &c->environ, &env); } /* Create the new session. */ idx = -1 - options_get_number(global_s_options, "base-index"); ! s = session_create(newname, argc, argv, path, cwd, &env, tiop, idx, sx, sy, &cause); if (s == NULL) { cmdq_error(cmdq, "create session failed: %s", cause); free(cause); goto error; } - environ_free(&env); /* Set the initial window name if one given. */ if (argc >= 0 && args_has(args, 'n')) { --- 223,252 ---- path = NULL; if (c != NULL && c->session == NULL) ! envent = environ_find(c->environ, "PATH"); else ! envent = environ_find(global_environ, "PATH"); if (envent != NULL) path = envent->value; /* Construct the environment. */ ! env = environ_create(); if (c != NULL && !args_has(args, 'E')) { update = options_get_string(global_s_options, "update-environment"); ! environ_update(update, c->environ, env); } /* Create the new session. */ idx = -1 - options_get_number(global_s_options, "base-index"); ! s = session_create(newname, argc, argv, path, cwd, env, tiop, idx, sx, sy, &cause); + environ_free(env); if (s == NULL) { cmdq_error(cmdq, "create session failed: %s", cause); free(cause); goto error; } /* Set the initial window name if one given. */ if (argc >= 0 && args_has(args, 'n')) {