Index: sys/netinet/in_pcb.c =================================================================== --- sys/netinet/in_pcb.c +++ sys/netinet/in_pcb.c @@ -506,6 +506,7 @@ * Different protocols initialize their inpcbs differently - giving * different name to the lock. But they all are disposed the same. */ +static void inpcb_dtor(void *, int, void *); static void inpcb_fini(void *mem, int size) { @@ -542,7 +543,7 @@ pcbinfo->ipi_lbgrouphashbase = hashinit(porthash_nelements, M_PCB, &pcbinfo->ipi_lbgrouphashmask); pcbinfo->ipi_zone = uma_zcreate(inpcbzone_name, sizeof(struct inpcb), - NULL, NULL, inpcbzone_init, inpcb_fini, UMA_ALIGN_PTR, + NULL, inpcb_dtor, inpcbzone_init, inpcb_fini, UMA_ALIGN_PTR, UMA_ZONE_SMR); uma_zone_set_max(pcbinfo->ipi_zone, maxsockets); uma_zone_set_warning(pcbinfo->ipi_zone, @@ -644,7 +645,6 @@ #if defined(IPSEC) || defined(IPSEC_SUPPORT) || defined(MAC) out: - crfree(inp->inp_cred); uma_zfree_smr(pcbinfo->ipi_zone, inp); return (error); #endif @@ -1833,7 +1833,6 @@ inp->inp_flags &= ~INP_INHASHLIST; } - crfree(inp->inp_cred); RO_INVALIDATE_CACHE(&inp->inp_route); #ifdef MAC mac_inpcb_destroy(inp); @@ -1864,6 +1863,15 @@ #ifdef INET inp_freemoptions(imo); #endif + /* Destruction is finalized in inpcb_dtor(). */ +} + +static void +inpcb_dtor(void *mem, int size, void *arg) +{ + struct inpcb *inp = mem; + + crfree(inp->inp_cred); } /*