diff options
author | Thomas Nordin <nordin@cvs.openbsd.org> | 2002-07-30 00:17:11 +0000 |
---|---|---|
committer | Thomas Nordin <nordin@cvs.openbsd.org> | 2002-07-30 00:17:11 +0000 |
commit | e8dafc3ee7f471f40358a20524843ff29e83e5ca (patch) | |
tree | 4b541648ef72023db83a56f868b380da1b1195d5 | |
parent | 0e3b7dd62f00bc51db18ed8d9b2eba4fa208b948 (diff) |
Release sessions to avoid memory leak. From NetBSD. ok deraadt@
-rw-r--r-- | sys/kern/tty.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index be858982f4f..7199e77c337 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.54 2002/07/11 22:48:51 art Exp $ */ +/* $OpenBSD: tty.c,v 1.55 2002/07/30 00:17:10 nordin Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -59,6 +59,7 @@ #include <sys/signalvar.h> #include <sys/resourcevar.h> #include <sys/sysctl.h> +#include <sys/pool.h> #include <sys/namei.h> @@ -209,6 +210,8 @@ ttyclose(tp) tp->t_gen++; tp->t_pgrp = NULL; + if (tp->t_session) + SESSRELE(tp->t_session); tp->t_session = NULL; tp->t_state = 0; return (0); @@ -985,6 +988,8 @@ ttioctl(tp, cmd, data, flag, p) ((p->p_session->s_ttyvp || tp->t_session) && (tp->t_session != p->p_session))) return (EPERM); + if (tp->t_session) + SESSRELE(tp->t_session); SESSHOLD(p->p_session); tp->t_session = p->p_session; tp->t_pgrp = p->p_pgrp; |