Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc6802a7 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

tty: handle NULL parameters in free_tty_struct()



We sometimes pass NULL pointers to free_tty_struct().  One example where
it can happen is in the error handling code in pty_common_install().

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4ac5d705
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -181,6 +181,8 @@ struct tty_struct *alloc_tty_struct(void)

void free_tty_struct(struct tty_struct *tty)
{
	if (!tty)
		return;
	if (tty->dev)
		put_device(tty->dev);
	kfree(tty->write_buf);