diff options
author | 2014-02-17 23:07:03 +0000 | |
---|---|---|
committer | 2014-02-17 23:07:03 +0000 | |
commit | 1ac29a775d849917840d63aef99eb2f74bd51d40 (patch) | |
tree | 79af693d216042a071ef7794c5e18234b4cb8223 /usr.bin/tmux/paste.c | |
parent | Having CpuSMAP and Cpu64 overlap isn't a terribly good idea. (diff) | |
download | wireguard-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/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); |