diff options
author | 2017-08-24 08:48:37 +0000 | |
---|---|---|
committer | 2017-08-24 08:48:37 +0000 | |
commit | 7da6a859924859d470254ac7b8d62a4ac9cabf29 (patch) | |
tree | 36c4c848228b7d8ce4b0551dd826da0280eea91e /usr.bin/tmux/tty.c | |
parent | Fix a memory leak in an error path. Coverity CID 1453101. (diff) | |
download | wireguard-openbsd-7da6a859924859d470254ac7b8d62a4ac9cabf29.tar.xz wireguard-openbsd-7da6a859924859d470254ac7b8d62a4ac9cabf29.zip |
When tty is error or closed, remove client. Reported by Thomas Sattler.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r-- | usr.bin/tmux/tty.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 66edbfa5b35..fd18fa81e29 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.294 2017/08/21 21:02:58 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.295 2017/08/24 08:48:37 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -159,8 +159,9 @@ tty_read_callback(__unused int fd, __unused short events, void *data) int nread; nread = evbuffer_read(tty->in, tty->fd, -1); - if (nread == -1) { + if (nread == 0 || nread == -1) { event_del(&tty->event_in); + server_client_lost(tty->client); return; } log_debug("%s: read %d bytes (already %zu)", c->name, nread, size); |