summaryrefslogtreecommitdiff
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2002-03-20 21:00:50 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2002-03-20 21:00:50 +0000
commitc1a513c951a93df463405b2972430c6f3beb8b63 (patch)
treeaa00539e2d2adbed6472b867adf8f87751da83ae /sys/kern/kern_prot.c
parent565f27f116fb870ee901657aff259bcf57cb3ae7 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 90f51964567e..a259919807dc 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1699,6 +1699,7 @@ crfree(cr)
* allocate a uidinfo structure.
*/
mtx_unlock(mtxp);
+ mtx_lock(&Giant);
if (cr->cr_uidinfo != NULL)
uifree(cr->cr_uidinfo);
if (cr->cr_ruidinfo != NULL)
@@ -1709,6 +1710,7 @@ crfree(cr)
if (jailed(cr))
prison_free(cr->cr_prison);
FREE((caddr_t)cr, M_CRED);
+ mtx_unlock(&Giant);
} else {
mtx_unlock(mtxp);
}
@@ -1761,6 +1763,19 @@ crdup(cr)
return (newcr);
}
+#ifdef DIAGNOSTIC
+void
+cred_free_thread(struct thread *td)
+{
+ struct ucred *cred;
+
+ cred = td->td_ucred;
+ td->td_ucred = NULL;
+ if (cred != NULL)
+ crfree(cred);
+}
+#endif
+
/*
* Fill in a struct xucred based on a struct ucred.
*/