diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index b25d6c4014a54397448fc64fb215a5121c62a77b..21bddf359dbbc5e732457c38315bef54575f5e08 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -304,7 +304,7 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty) the easy way .. */ retval = tty_init_termios(tty); if (retval) - goto err_module_put; + goto err_deinit_tty; retval = tty_init_termios(o_tty); if (retval) @@ -327,7 +327,8 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty) return 0; err_free_termios: tty_free_termios(tty); -err_module_put: +err_deinit_tty: + deinitialize_tty_struct(o_tty); module_put(o_tty->driver->owner); err_free_tty: free_tty_struct(o_tty); @@ -592,6 +593,7 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) pty_count++; return 0; err_free_mem: + deinitialize_tty_struct(o_tty); kfree(o_tty->termios); kfree(tty->termios); module_put(o_tty->driver->owner); diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index f5dd23520fe3fb17581cc9b4bedfa38bf0184c5f..8540f2bab9c60f6438e19302703cfc98b5130d6f 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -1399,7 +1399,7 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, retval = tty_driver_install_tty(driver, tty); if (retval < 0) - goto err_free_tty; + goto err_deinit_tty; /* * Structures all installed ... call the ldisc open routines. @@ -1411,7 +1411,8 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, goto err_release_tty; return tty; -err_free_tty: +err_deinit_tty: + deinitialize_tty_struct(tty); free_tty_struct(tty); err_module_put: module_put(driver->owner);