summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-05-08 20:35:58 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-05-08 20:35:58 +0000
commit6f0847204995b831a74a5826be4272fc03d27746 (patch)
tree66992c324409d71276338956b31019e02dcf2bb9 /cmd.c
parentf3741f0653e2a38b9d52851fb187d2592612a7c1 (diff)
Fix a memory leak if cmd_pane_session succeeds, from Tiago Cunha.
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd.c b/cmd.c
index ee893a25..f1cba109 100644
--- a/cmd.c
+++ b/cmd.c
@@ -714,20 +714,20 @@ cmd_find_session(struct cmd_ctx *ctx, const char *arg, int prefer_unattached)
/* A NULL argument means the current session. */
if (arg == NULL)
return (cmd_current_session(ctx, prefer_unattached));
- tmparg = xstrdup(arg);
/* Lookup as pane id. */
if ((wp = cmd_lookup_paneid(arg)) != NULL)
return (cmd_pane_session(ctx, wp, NULL));
/* Trim a single trailing colon if any. */
+ tmparg = xstrdup(arg);
arglen = strlen(tmparg);
if (arglen != 0 && tmparg[arglen - 1] == ':')
tmparg[arglen - 1] = '\0';
/* An empty session name is the current session. */
if (*tmparg == '\0') {
- xfree (tmparg);
+ xfree(tmparg);
return (cmd_current_session(ctx, prefer_unattached));
}