summaryrefslogtreecommitdiffstats
path: root/cmd-capture-pane.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-05-08 20:37:04 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-05-08 20:37:04 +0000
commit538af37c356de783ceb01fff456eb379a2ff0d07 (patch)
tree5f4197dcc4f2a11d7a2c8dc5833d8f6866195259 /cmd-capture-pane.c
parent6f0847204995b831a74a5826be4272fc03d27746 (diff)
Fix a couple of memory leaks, from Tiago Cunha.
Diffstat (limited to 'cmd-capture-pane.c')
-rw-r--r--cmd-capture-pane.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index 52f5455c..bdf74106 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -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;