mirror of
https://github.com/tmux/tmux.git
synced 2025-03-13 21:58:48 +00:00
Fix a memory leak if cmd_pane_session succeeds, from Tiago Cunha.
This commit is contained in:
parent
f3741f0653
commit
6f08472049
2
cmd.c
2
cmd.c
@ -714,13 +714,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';
|
||||
|
Loading…
Reference in New Issue
Block a user