From 22ec200d7cd0daf8c7c4050e70a806dc14ba1978 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Sat, 4 Apr 2020 17:12:57 +0800 Subject: [PATCH] pty_on_exit: Fix bug: reference a freed pointer The result is that the server session cannot be released. Signed-off-by: Jianhui Zhao --- src/rtty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rtty.c b/src/rtty.c index d2665d1..2ef1628 100644 --- a/src/rtty.c +++ b/src/rtty.c @@ -130,12 +130,12 @@ static void pty_on_exit(struct ev_loop *loop, struct ev_child *w, int revents) struct rtty *rtty = tty->rtty; struct buffer *wb = &rtty->wb; - del_tty(tty); - buffer_put_u8(wb, MSG_TYPE_LOGOUT); buffer_put_u16be(wb, 1); buffer_put_u8(wb, tty->sid); ev_io_start(loop, &rtty->iow); + + del_tty(tty); } static void tty_login(struct rtty *rtty)