summaryrefslogtreecommitdiff
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2002-02-27 18:30:01 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2002-02-27 18:30:01 +0000
commit65e3406d28b159fab93b499d25ed079b2c978ff7 (patch)
tree2a10480f644fa7d553c28438685c71db5365dc83 /sys/kern/kern_prot.c
parent0c934a5eed829453c69ef7c66c2740bef07fbe72 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index a992e64c9277..cfcef0a36a8d 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1785,17 +1785,17 @@ void
cred_update_thread(struct thread *td)
{
struct proc *p;
+ struct ucred *cred;
p = td->td_proc;
- if (td->td_ucred != NULL) {
- mtx_lock(&Giant);
- crfree(td->td_ucred);
- mtx_unlock(&Giant);
- td->td_ucred = NULL;
- }
+ cred = td->td_ucred;
+ mtx_lock(&Giant);
PROC_LOCK(p);
td->td_ucred = crhold(p->p_ucred);
PROC_UNLOCK(p);
+ if (cred != NULL)
+ crfree(cred);
+ mtx_unlock(&Giant);
}
/*