Print this page
6659 nvlist_free(NULL) is a no-op


1820 /*
1821  * cte_rele
1822  *
1823  * Releases a hold on the specified event.  If the caller had the last
1824  * reference, frees the event and releases its hold on the contract
1825  * that generated it.
1826  */
1827 static void
1828 cte_rele(ct_kevent_t *e)
1829 {
1830         mutex_enter(&e->cte_lock);
1831         ASSERT(e->cte_refs > 0);
1832         if (--e->cte_refs) {
1833                 mutex_exit(&e->cte_lock);
1834                 return;
1835         }
1836 
1837         contract_rele(e->cte_contract);
1838 
1839         mutex_destroy(&e->cte_lock);
1840         if (e->cte_data)
1841                 nvlist_free(e->cte_data);
1842         if (e->cte_gdata)
1843                 nvlist_free(e->cte_gdata);
1844         kmem_free(e, sizeof (ct_kevent_t));
1845 }
1846 
1847 /*
1848  * cte_qrele
1849  *
1850  * Remove this listener's hold on the specified event, removing and
1851  * releasing the queue's hold on the event if appropriate.
1852  */
1853 static void
1854 cte_qrele(ct_equeue_t *q, ct_listener_t *l, ct_kevent_t *e)
1855 {
1856         ct_member_t *member = &e->cte_nodes[q->ctq_listno];
1857 
1858         ASSERT(MUTEX_HELD(&q->ctq_lock));
1859 
1860         if (l->ctl_flags & CTLF_RELIABLE)
1861                 member->ctm_nreliable--;
1862         if ((--member->ctm_refs == 0) && member->ctm_trimmed) {




1820 /*
1821  * cte_rele
1822  *
1823  * Releases a hold on the specified event.  If the caller had the last
1824  * reference, frees the event and releases its hold on the contract
1825  * that generated it.
1826  */
1827 static void
1828 cte_rele(ct_kevent_t *e)
1829 {
1830         mutex_enter(&e->cte_lock);
1831         ASSERT(e->cte_refs > 0);
1832         if (--e->cte_refs) {
1833                 mutex_exit(&e->cte_lock);
1834                 return;
1835         }
1836 
1837         contract_rele(e->cte_contract);
1838 
1839         mutex_destroy(&e->cte_lock);

1840         nvlist_free(e->cte_data);

1841         nvlist_free(e->cte_gdata);
1842         kmem_free(e, sizeof (ct_kevent_t));
1843 }
1844 
1845 /*
1846  * cte_qrele
1847  *
1848  * Remove this listener's hold on the specified event, removing and
1849  * releasing the queue's hold on the event if appropriate.
1850  */
1851 static void
1852 cte_qrele(ct_equeue_t *q, ct_listener_t *l, ct_kevent_t *e)
1853 {
1854         ct_member_t *member = &e->cte_nodes[q->ctq_listno];
1855 
1856         ASSERT(MUTEX_HELD(&q->ctq_lock));
1857 
1858         if (l->ctl_flags & CTLF_RELIABLE)
1859                 member->ctm_nreliable--;
1860         if ((--member->ctm_refs == 0) && member->ctm_trimmed) {