summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 0cf3c04..9719b79 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -125,10 +125,8 @@ socreate(dom, aso, type, proto, p)
TAILQ_INIT(&so->so_incomp);
TAILQ_INIT(&so->so_comp);
so->so_type = type;
- if (p) {
- so->so_cred = p->p_cred;
- so->so_cred->p_refcnt++;
- } else so->so_cred = NULL;
+ so->so_cred = p->p_ucred;
+ crhold(so->so_cred);
so->so_proto = prp;
error = (*prp->pr_usrreqs->pru_attach)(so, proto, p);
if (error) {
@@ -158,11 +156,9 @@ void
sodealloc(so)
struct socket *so;
{
+
so->so_gencnt = ++so_gencnt;
- if (so->so_cred && --so->so_cred->p_refcnt == 0) {
- crfree(so->so_cred->pc_ucred);
- FREE(so->so_cred, M_SUBPROC);
- }
+ crfree(so->so_cred);
zfreei(so->so_zone, so);
}
OpenPOWER on IntegriCloud