Call tty_close() at the very end of ttyclose() since otherwise NULL

deferences can occur since tty_close() may end up freeing the tty structure
if it drops the last reference to it.

Glanced at by:	phk
This commit is contained in:
John Baldwin 2004-12-30 19:24:49 +00:00
parent 1c622ae41e
commit 9e6c867ccc

View File

@ -3172,10 +3172,10 @@ ttyclose(struct cdev *dev, int flag, int mode, struct thread *td)
ttyldoptim(tp);
if (tp->t_close != NULL)
tp->t_close(tp);
tty_close(tp);
tp->t_do_timestamp = 0;
if (tp->t_pps != NULL)
tp->t_pps->ppsparam.mode = 0;
tty_close(tp);
return (0);
}