summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2014-02-17 23:07:03 +0000
committernicm <nicm@openbsd.org>2014-02-17 23:07:03 +0000
commit1ac29a775d849917840d63aef99eb2f74bd51d40 (patch)
tree79af693d216042a071ef7794c5e18234b4cb8223 /usr.bin/tmux/window-copy.c
parentHaving CpuSMAP and Cpu64 overlap isn't a terribly good idea. (diff)
downloadwireguard-openbsd-1ac29a775d849917840d63aef99eb2f74bd51d40.tar.xz
wireguard-openbsd-1ac29a775d849917840d63aef99eb2f74bd51d40.zip
Fix memory leaks with paste_replace, based on changes from J Raynor.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 34d9b28c41c..c8f936025bd 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.101 2014/01/28 23:07:09 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.102 2014/02/17 23:07:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1455,8 +1455,8 @@ window_copy_copy_buffer(struct window_pane *wp, int idx, void *buf, size_t len)
if (idx == -1) {
limit = options_get_number(&global_options, "buffer-limit");
paste_add(&global_buffers, buf, len, limit);
- } else
- paste_replace(&global_buffers, idx, buf, len);
+ } else if (paste_replace(&global_buffers, idx, buf, len) != 0)
+ free(buf);
}
void