summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2011-08-30 09:18:53 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2011-08-30 09:18:53 +0000
commitfc7b99966d838fe31852f286910def3f0b1df565 (patch)
treed389b804ea81869e22802c987970a08568fe5bbd /usr.bin
parent3ab97bfd07e3e0e421c83e6296ea376b67dda432 (diff)
Plug memory leak, from Tiago Cunha.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-split-window.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c
index 04ff6ad1fa4..e2f1591c959 100644
--- a/usr.bin/tmux/cmd-split-window.c
+++ b/usr.bin/tmux/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-split-window.c,v 1.23 2011/02/10 12:12:14 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.24 2011/08/30 09:18:52 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -58,7 +58,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;
@@ -94,16 +94,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;