summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/paste.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-01-24 13:28:33 +0000
committernicm <nicm@openbsd.org>2017-01-24 13:28:33 +0000
commit01c6300247f3189a064b34c9ceb30378bcb8f148 (patch)
tree2802612bcec2817f1d4bb0ffafe0abaee30fc6db /usr.bin/tmux/paste.c
parentnuke extra brackets. discussed with jsing (diff)
downloadwireguard-openbsd-01c6300247f3189a064b34c9ceb30378bcb8f148.tar.xz
wireguard-openbsd-01c6300247f3189a064b34c9ceb30378bcb8f148.zip
Shorten a long line, and don't leak buffer in paste_add if size is zero.
Diffstat (limited to 'usr.bin/tmux/paste.c')
-rw-r--r--usr.bin/tmux/paste.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/paste.c b/usr.bin/tmux/paste.c
index 7d4c716642e..9c77846010e 100644
--- a/usr.bin/tmux/paste.c
+++ b/usr.bin/tmux/paste.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: paste.c,v 1.38 2016/10/12 09:07:58 nicm Exp $ */
+/* $OpenBSD: paste.c,v 1.39 2017/01/24 13:28:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -163,8 +163,10 @@ paste_add(char *data, size_t size)
struct paste_buffer *pb, *pb1;
u_int limit;
- if (size == 0)
+ if (size == 0) {
+ free(data);
return;
+ }
limit = options_get_number(global_options, "buffer-limit");
RB_FOREACH_REVERSE_SAFE(pb, paste_time_tree, &paste_by_time, pb1) {