diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-09-21 16:34:04 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-09-21 16:34:04 +0000 |
commit | cb752f9938cebb056321930d4b1f718db4992534 (patch) | |
tree | d8c1c79ed6f0b57198a3c2d89ae7be8155068072 /cmd-split-window.c | |
parent | 2e98603db991acb1f2b003524c72556d250ca972 (diff) | |
download | rtmux-cb752f9938cebb056321930d4b1f718db4992534.tar.gz rtmux-cb752f9938cebb056321930d4b1f718db4992534.tar.bz2 rtmux-cb752f9938cebb056321930d4b1f718db4992534.zip |
Sync OpenBSD patchset 955:
Plug memory leak, from Tiago Cunha.
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r-- | cmd-split-window.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c index 8545a54e..6a95e1ba 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -57,7 +57,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct window *w; struct window_pane *wp, *new_wp = NULL; struct environ env; - char *cmd, *cwd, *cause; + char *cmd, *cwd, *cause, *new_cause; const char *shell; u_int hlimit, paneidx; int size, percentage; @@ -93,16 +93,18 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(args, 'l')) { size = args_strtonum(args, 'l', 0, INT_MAX, &cause); if (cause != NULL) { - ctx->error(ctx, "size %s", cause); + xasprintf(&new_cause, "size %s", cause); xfree(cause); - return (-1); + cause = new_cause; + goto error; } } else if (args_has(args, 'p')) { percentage = args_strtonum(args, 'p', 0, INT_MAX, &cause); if (cause != NULL) { - ctx->error(ctx, "percentage %s", cause); + xasprintf(&new_cause, "percentage %s", cause); xfree(cause); - return (-1); + cause = new_cause; + goto error; } if (type == LAYOUT_TOPBOTTOM) size = (wp->sy * percentage) / 100; |