Ignore:
Timestamp:
Mar 31, 2017 9:52:12 AM (2 years ago)
Author:
riza
Message:

Fix #2007: Fix Possible crash when using session timer due to the early release of dialog pool.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c

    r5557 r5576  
    334334    pj_status_t status; 
    335335    pj_bool_t as_refresher; 
     336    int entry_id; 
     337    char obj_name[PJ_MAX_OBJ_NAME]; 
    336338 
    337339    pj_assert(inv); 
     
    345347    as_refresher = 
    346348        (inv->timer->refresher == TR_UAC && inv->timer->role == PJSIP_ROLE_UAC) || 
    347         (inv->timer->refresher == TR_UAS && inv->timer->role == PJSIP_ROLE_UAS);     
     349        (inv->timer->refresher == TR_UAS && inv->timer->role == PJSIP_ROLE_UAS); 
     350 
     351    entry_id = entry->id; 
     352    pj_ansi_strncpy(obj_name, inv->pool->obj_name, PJ_MAX_OBJ_NAME); 
    348353 
    349354    /* Do action based on role(refresher or refreshee).  
     
    354359     * - end session if there is no refresh request received. 
    355360     */ 
    356     if (as_refresher && (entry->id != REFRESHER_EXPIRE_TIMER_ID)) { 
     361    if (as_refresher && (entry_id != REFRESHER_EXPIRE_TIMER_ID)) { 
    357362        pj_time_val now; 
    358363 
     
    415420 
    416421        pj_gettimeofday(&now); 
    417         PJ_LOG(4, (inv->pool->obj_name, 
     422        PJ_LOG(4, (obj_name, 
    418423                   "Refreshing session after %ds (expiration period=%ds)", 
    419424                   (now.sec-inv->timer->last_refresh.sec), 
     
    433438 
    434439        pj_gettimeofday(&now); 
    435         PJ_LOG(3, (inv->pool->obj_name,  
     440        PJ_LOG(3, (obj_name, 
    436441                   "No session %s received after %ds " 
    437442                   "(expiration period=%ds), stopping session now!", 
     
    452457    } 
    453458 
     459    /* 
     460     * At this point, dialog might have already been destroyed, 
     461     * including its pool used by the invite session. 
     462     */ 
     463 
    454464    /* Print error message, if any */ 
    455465    if (status != PJ_SUCCESS) { 
    456         PJ_PERROR(2, (inv->pool->obj_name, status, 
     466        PJ_PERROR(2, (obj_name, status, 
    457467                     "Error in %s session timer", 
    458                      ((as_refresher && entry->id != REFRESHER_EXPIRE_TIMER_ID)?  
     468                     ((as_refresher && entry_id != REFRESHER_EXPIRE_TIMER_ID)? 
    459469                       "refreshing" : "terminating"))); 
    460470    } 
Note: See TracChangeset for help on using the changeset viewer.