diff options
-rw-r--r-- | drivers/tty/pty.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_port.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 0ce0b3ec2bb0..a541ec875932 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -408,7 +408,7 @@ static void pty_unix98_shutdown(struct tty_struct *tty) | |||
408 | static void pty_cleanup(struct tty_struct *tty) | 408 | static void pty_cleanup(struct tty_struct *tty) |
409 | { | 409 | { |
410 | tty->port->itty = NULL; | 410 | tty->port->itty = NULL; |
411 | kfree(tty->port); | 411 | tty_port_put(tty->port); |
412 | } | 412 | } |
413 | 413 | ||
414 | /* Traditional BSD devices */ | 414 | /* Traditional BSD devices */ |
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 416b42f7c346..fdc42c2d565f 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c | |||
@@ -128,7 +128,7 @@ static void tty_port_destructor(struct kref *kref) | |||
128 | if (port->xmit_buf) | 128 | if (port->xmit_buf) |
129 | free_page((unsigned long)port->xmit_buf); | 129 | free_page((unsigned long)port->xmit_buf); |
130 | tty_buffer_free_all(port); | 130 | tty_buffer_free_all(port); |
131 | if (port->ops->destruct) | 131 | if (port->ops && port->ops->destruct) |
132 | port->ops->destruct(port); | 132 | port->ops->destruct(port); |
133 | else | 133 | else |
134 | kfree(port); | 134 | kfree(port); |