FreeBSD/sys/netinet/in_mcast.c
/*
 * Drop a reference to an in_multi record.
 *
 * If the refcount drops to 0, free the in_multi record and
 * delete the underlying link-layer membership.
 */
Drop a reference to an in_multi record.
If the refcount drops to 0, free the in_multi record and
delete the underlying link-layer membership.
Drop a reference to an in_multi record . If the refcount drops to 0 free the in_multi record and delete the underlying link - layer membership .
void
inm_release_locked(struct in_multi *inm)
{
	struct ifmultiaddr *ifma;
	IN_MULTI_LOCK_ASSERT();
	CTR2(KTR_IGMPV3, "%s: refcount is %d", __func__, inm->inm_refcount);
	if (--inm->inm_refcount > 0) {
		CTR2(KTR_IGMPV3, "%s: refcount is now %d", __func__,
		    inm->inm_refcount);
		return;
	}
	CTR2(KTR_IGMPV3, "%s: freeing inm %p", __func__, inm);
	ifma = inm->inm_ifma;
	CTR2(KTR_IGMPV3, "%s: purging ifma %p", __func__, ifma);
	KASSERT(ifma->ifma_protospec == inm,
	    ("%s: ifma_protospec != inm", __func__));
	ifma->ifma_protospec = NULL;
	inm_purge(inm);
	free(inm, M_IPMADDR);
	if_delmulti_ifma(ifma);
}
void inm_release_locked ( struct in_multi * inm ) { struct ifmultiaddr * ifma ; IN_MULTI_LOCK_ASSERT ( ) ; CTR2 ( KTR_IGMPV3 , " " , __func__ , inm -> inm_refcount ) ; if ( -- inm -> inm_refcount > 0 ) { CTR2 ( KTR_IGMPV3 , " " , __func__ , inm -> inm_refcount ) ; return ; } CTR2 ( KTR_IGMPV3 , " " , __func__ , inm ) ; ifma = inm -> inm_ifma ; CTR2 ( KTR_IGMPV3 , " " , __func__ , ifma ) ; KASSERT ( ifma -> ifma_protospec == inm , ( " " , __func__ ) ) ; ifma -> ifma_protospec = NULL ; inm_purge ( inm ) ; free ( inm , M_IPMADDR ) ; if_delmulti_ifma ( ifma ) ; }
Drop a reference to an in_multi record.
Drop a reference to an in_multi record .
/* XXX this access is not covered by IF_ADDR_LOCK */