summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2011-05-08 20:35:58 +0000
committernicm <nicm@openbsd.org>2011-05-08 20:35:58 +0000
commitda4f50edca923d45f66019f6bcf316e3af81157b (patch)
tree904138087747f2569bc03a0909179c578666b347
parentAdd a new option, mouse-resize-pane. When on, panes may be resized by (diff)
downloadwireguard-openbsd-da4f50edca923d45f66019f6bcf316e3af81157b.tar.xz
wireguard-openbsd-da4f50edca923d45f66019f6bcf316e3af81157b.zip
Fix a memory leak if cmd_pane_session succeeds, from Tiago Cunha.
-rw-r--r--usr.bin/tmux/cmd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 4080b27182b..e6e2deee701 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.53 2011/04/06 21:51:31 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.54 2011/05/08 20:35:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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));
}