diff options
| author | 2002-07-30 00:17:10 +0000 | |
|---|---|---|
| committer | 2002-07-30 00:17:10 +0000 | |
| commit | 04726abd237a437064739e0d2f844754ce6b8f7c (patch) | |
| tree | 5f1cc353cd32bb8e45dadfbd869550940685abad | |
| parent | be even more careful with strlcpy() (diff) | |
| download | wireguard-openbsd-04726abd237a437064739e0d2f844754ce6b8f7c.tar.xz wireguard-openbsd-04726abd237a437064739e0d2f844754ce6b8f7c.zip | |
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; |
