summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 2681876b848..c63330165ac 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.120 2013/03/28 16:55:25 deraadt Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.121 2013/03/30 06:32:25 tedu Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -120,6 +120,7 @@ exit1(struct proc *p, int rv, int flags)
{
struct process *pr, *qr, *nqr;
struct rusage *rup;
+ struct vnode *ovp;
if (p->p_pid == 1)
panic("init died (signal %d, exit %d)",
@@ -216,9 +217,10 @@ exit1(struct proc *p, int rv, int flags)
VOP_REVOKE(sp->s_ttyvp,
REVOKEALL);
}
- if (sp->s_ttyvp)
- vrele(sp->s_ttyvp);
+ ovp = sp->s_ttyvp;
sp->s_ttyvp = NULL;
+ if (ovp)
+ vrele(ovp);
/*
* s_ttyp is not zero'd; we use this to
* indicate that the session once had a
@@ -604,6 +606,7 @@ void
proc_zap(struct proc *p)
{
struct process *pr = p->p_p;
+ struct vnode *otvp;
/*
* Finally finished with old proc entry.
@@ -624,8 +627,10 @@ proc_zap(struct proc *p)
/*
* Release reference to text vnode
*/
- if (p->p_textvp)
- vrele(p->p_textvp);
+ otvp = p->p_textvp;
+ p->p_textvp = NULL;
+ if (otvp)
+ vrele(otvp);
/*
* Remove us from our process list, possibly killing the process