summaryrefslogtreecommitdiff
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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 74ac47d02f8..ab2f0de086d 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.177 2019/06/13 21:19:28 mpi Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.178 2019/06/21 09:39:48 visa Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -328,6 +328,15 @@ exit1(struct proc *p, int rv, int flags)
KASSERT(pr->ps_refcnt > 0);
}
+ /* Release the thread's read reference of resource limit structure. */
+ if (p->p_limit != NULL) {
+ struct plimit *limit;
+
+ limit = p->p_limit;
+ p->p_limit = NULL;
+ lim_free(limit);
+ }
+
/*
* Other substructures are freed from reaper and wait().
*/
@@ -636,7 +645,7 @@ process_zap(struct process *pr)
free(pr->ps_ptstat, M_SUBPROC, sizeof(*pr->ps_ptstat));
pool_put(&rusage_pool, pr->ps_ru);
KASSERT(TAILQ_EMPTY(&pr->ps_threads));
- limfree(pr->ps_limit);
+ lim_free(pr->ps_limit);
crfree(pr->ps_ucred);
pool_put(&process_pool, pr);
nprocesses--;