Ignore:
Timestamp:
Nov 29, 2010 2:49:37 PM (13 years ago)
Author:
bennylp
Message:

Fixed #1164: Possible crash in PUBLISH session if network connectivity is lost between two requests (thanks Nikolay Popok for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-simple/publishc.c

    r3108 r3375  
    7575    pj_bool_t                    _delete_flag; 
    7676    int                          pending_tsx; 
     77    pj_bool_t                    in_callback; 
    7778    pj_mutex_t                  *mutex; 
    7879 
     
    205206    PJ_ASSERT_RETURN(pubc, PJ_EINVAL); 
    206207 
    207     if (pubc->pending_tsx) { 
     208    if (pubc->pending_tsx || pubc->in_callback) { 
    208209        pubc->_delete_flag = 1; 
    209210        pubc->cb = NULL; 
     
    554555    pj_assert(pubc->pending_tsx > 0); 
    555556    --pubc->pending_tsx; 
     557 
     558    /* Mark that we're in callback to prevent deletion (#1164) */ 
     559    ++pubc->in_callback; 
    556560 
    557561    /* If publication data has been deleted by user then remove publication  
     
    698702    } 
    699703 
     704    /* No longer in callback. */ 
     705    --pubc->in_callback; 
     706 
    700707    /* Delete the record if user destroy pubc during the callback. */ 
    701708    if (pubc->_delete_flag && pubc->pending_tsx==0) { 
Note: See TracChangeset for help on using the changeset viewer.