Sync OpenBSD patchset 906:

Fix a memory leak if cmd_pane_session succeeds, from Tiago Cunha.
This commit is contained in:
Tiago Cunha 2011-05-18 20:30:36 +00:00
parent 4efd45628d
commit 1d2b487c84

4
cmd.c
View File

@ -1,4 +1,4 @@
/* $Id: cmd.c,v 1.152 2011-04-06 22:29:26 nicm Exp $ */
/* $Id: cmd.c,v 1.153 2011-05-18 20:30:36 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -713,13 +713,13 @@ 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';