From 5596355a5c9c08414df939334dcad5c234158a1f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 8 May 2011 20:37:05 +0000 Subject: Fix a couple of memory leaks, from Tiago Cunha. --- usr.bin/tmux/cmd-capture-pane.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'usr.bin') 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 @@ -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; -- cgit v1.2.3