Ignore:
Timestamp:
Apr 14, 2009 11:10:31 AM (11 years ago)
Author:
bennylp
Message:

Ticket #786: Crash when UAC invite or subscribe session initialization fails (thanks Rostislav Molodyko for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c

    r2394 r2593  
    14431443    } 
    14441444 
     1445    /* Increment the dialog's lock otherwise when presence session creation 
     1446     * fails the dialog will be destroyed prematurely. 
     1447     */ 
     1448    pjsip_dlg_inc_lock(buddy->dlg); 
     1449 
    14451450    status = pjsip_pres_create_uac( buddy->dlg, &pres_callback,  
    14461451                                    PJSIP_EVSUB_NO_EVENT_ID, &buddy->sub); 
     
    14491454        pjsua_perror(THIS_FILE, "Unable to create presence client",  
    14501455                     status); 
    1451         pjsip_dlg_terminate(buddy->dlg); 
     1456        /* This should destroy the dialog since there's no session 
     1457         * referencing it 
     1458         */ 
     1459        pjsip_dlg_dec_lock(buddy->dlg); 
    14521460        if (tmp_pool) pj_pool_release(tmp_pool); 
    14531461        return; 
     
    14821490    status = pjsip_pres_initiate(buddy->sub, -1, &tdata); 
    14831491    if (status != PJ_SUCCESS) { 
     1492        pjsip_dlg_dec_lock(buddy->dlg); 
    14841493        if (buddy->sub) { 
    14851494            pjsip_pres_terminate(buddy->sub, PJ_FALSE); 
     
    14961505    status = pjsip_pres_send_request(buddy->sub, tdata); 
    14971506    if (status != PJ_SUCCESS) { 
     1507        pjsip_dlg_dec_lock(buddy->dlg); 
    14981508        if (buddy->sub) { 
    14991509            pjsip_pres_terminate(buddy->sub, PJ_FALSE); 
     
    15061516    } 
    15071517 
     1518    pjsip_dlg_dec_lock(buddy->dlg); 
    15081519    if (tmp_pool) pj_pool_release(tmp_pool); 
    15091520} 
Note: See TracChangeset for help on using the changeset viewer.