diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-02-17 23:07:04 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-02-17 23:07:04 +0000 |
commit | 02df93feb6ccbddc394a87b2889167881fdb3708 (patch) | |
tree | 239af5879f088728fb30bfd2012128b174d0ec41 /usr.bin/tmux/paste.c | |
parent | cf90bbdad150cd1224f1d483f9057fff5e0b35ec (diff) |
Fix memory leaks with paste_replace, based on changes from J Raynor.
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 b79d41c76d0..b6f0f16939d 100644 --- a/usr.bin/tmux/paste.c +++ b/usr.bin/tmux/paste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.14 2012/11/27 20:22:12 nicm Exp $ */ +/* $OpenBSD: paste.c,v 1.15 2014/02/17 23:07:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -131,8 +131,10 @@ paste_replace(struct paste_stack *ps, u_int idx, char *data, size_t size) { struct paste_buffer *pb; - if (size == 0) + if (size == 0) { + free(data); return (0); + } if (idx >= ARRAY_LENGTH(ps)) return (-1); |