Ignore:
Timestamp:
Dec 17, 2008 2:28:18 PM (14 years ago)
Author:
bennylp
Message:

Ticket 684: protect the memory allocation for TX packet with try/catch, and fixed various transmit data buffer leaks when transmission fails immediately

File:
1 edited

Legend:

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

    r2370 r2380  
    541541    if (tsx) { 
    542542        pjsip_tsx_terminate(tsx, 500); 
     543        pj_assert(dlg->tsx_count>0); 
    543544        --dlg->tsx_count; 
    544545    } 
     
    14121413    /* Ask transaction to send the response */ 
    14131414    status = pjsip_tsx_send_msg(tsx, tdata); 
     1415 
     1416    /* This function must decrement transmit data request counter  
     1417     * regardless of the operation status. The transaction only 
     1418     * decrements the counter if the operation is successful. 
     1419     */ 
     1420    if (status != PJ_SUCCESS) { 
     1421        pjsip_tx_data_dec_ref(tdata); 
     1422    } 
    14141423 
    14151424    pjsip_dlg_dec_lock(dlg); 
     
    18991908 
    19001909 
    1901     if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     1910    /* It is possible that the transaction is terminated and this function 
     1911     * is called while we're calling on_tsx_state(). So only decrement 
     1912     * the tsx_count if we're still attached to the transaction. 
     1913     */ 
     1914    if (tsx->state == PJSIP_TSX_STATE_TERMINATED && 
     1915        tsx->mod_data[dlg->ua->id] == dlg)  
     1916    { 
     1917        pj_assert(dlg->tsx_count>0); 
    19021918        --dlg->tsx_count; 
    19031919        tsx->mod_data[dlg->ua->id] = NULL; 
Note: See TracChangeset for help on using the changeset viewer.