diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-05-08 20:37:05 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-05-08 20:37:05 +0000 |
commit | 5596355a5c9c08414df939334dcad5c234158a1f (patch) | |
tree | b813d618059533f403418a40aa7c6916ffac95f6 /usr.bin | |
parent | 11d041f1ae2b4a293eb240c8f3c012d237c9434e (diff) |
Fix a couple of memory leaks, from Tiago Cunha.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-capture-pane.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c index b7cd420cb43..87e1980ff26 100644 --- a/usr.bin/tmux/cmd-capture-pane.c +++ b/usr.bin/tmux/cmd-capture-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-capture-pane.c,v 1.7 2011/03/28 20:17:39 nicm Exp $ */ +/* $OpenBSD: cmd-capture-pane.c,v 1.8 2011/05/08 20:37:04 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> @@ -60,9 +60,10 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx) len = 0; n = args_strtonum(args, 'S', SHRT_MIN, SHRT_MAX, &cause); - if (cause != NULL) + if (cause != NULL) { top = gd->hsize; - else if (n < 0 && (u_int) -n > gd->hsize) + xfree(cause); + } else if (n < 0 && (u_int) -n > gd->hsize) top = 0; else top = gd->hsize + n; @@ -70,9 +71,10 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx) top = gd->hsize + gd->sy - 1; n = args_strtonum(args, 'E', SHRT_MIN, SHRT_MAX, &cause); - if (cause != NULL) + if (cause != NULL) { bottom = gd->hsize + gd->sy - 1; - else if (n < 0 && (u_int) -n > gd->hsize) + xfree(cause); + } else if (n < 0 && (u_int) -n > gd->hsize) bottom = 0; else bottom = gd->hsize + n; |