Changeset 5400


Ignore:
Timestamp:
Jul 28, 2016 3:17:04 AM (8 years ago)
Author:
nanang
Message:

Misc (re #1945): Updated checks in pjsip_tx_data_dec_ref(). Thanks Alexei Gradinari for the feedback and the patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport.c

    r5246 r5400  
    492492PJ_DEF(pj_status_t) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata ) 
    493493{ 
    494     pj_assert( pj_atomic_get(tdata->ref_cnt) > 0); 
    495     if (pj_atomic_dec_and_get(tdata->ref_cnt) <= 0) { 
     494    pj_atomic_value_t ref_cnt; 
     495     
     496    PJ_ASSERT_RETURN(tdata && tdata->ref_cnt, PJ_EINVAL); 
     497 
     498    ref_cnt = pj_atomic_dec_and_get(tdata->ref_cnt); 
     499    pj_assert( ref_cnt >= 0); 
     500    if (ref_cnt == 0) { 
    496501        tx_data_destroy(tdata); 
    497502        return PJSIP_EBUFDESTROYED; 
Note: See TracChangeset for help on using the changeset viewer.