diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-24 13:28:34 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-24 13:28:34 +0000 |
commit | 0e8517dc368bffb3c1dff0e82da47cb1d2cb78e4 (patch) | |
tree | e8bd454eabf9041c54653f727f7a359b3ed3b530 /usr.bin/tmux/paste.c | |
parent | a0c86f35a05481cad0d80b27e879126214b32337 (diff) |
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.c | 6 |
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) { |