Changeset 367


Ignore:
Timestamp:
Mar 30, 2006 4:46:07 PM (19 years ago)
Author:
bennylp
Message:

Fixed crash bug with poll_reset() in rdata

Location:
pjproject/trunk/pjsip/src/pjsip
Files:
2 edited

Legend:

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

    r315 r367  
    432432        } 
    433433        pj_assert(size != 0); 
     434        tdata->buf.cur[size] = '\0'; 
    434435        tdata->buf.cur += size; 
    435         tdata->buf.cur[size] = '\0'; 
    436436    } 
    437437 
  • pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c

    r315 r367  
    174174        } 
    175175 
    176         /* Reset pool. */ 
    177         pj_pool_reset(rdata->tp_info.pool); 
    178         init_rdata((struct udp_transport*)rdata->tp_info.transport, 
    179                    (unsigned)rdata->tp_info.tp_data, 
    180                    rdata->tp_info.pool, 
    181                    &rdata); 
     176        /* Reset pool.  
     177         * Need to copy rdata fields to temp variable because they will 
     178         * be invalid after pj_pool_reset(). 
     179         */ 
     180        { 
     181            pj_pool_t *rdata_pool = rdata->tp_info.pool; 
     182            struct udp_transport *rdata_tp ; 
     183            unsigned rdata_index; 
     184 
     185            rdata_tp = (struct udp_transport*)rdata->tp_info.transport; 
     186            rdata_index = (unsigned)rdata->tp_info.tp_data; 
     187 
     188            pj_pool_reset(rdata_pool); 
     189            init_rdata(rdata_tp, rdata_index, rdata_pool, &rdata); 
     190 
     191            /* Change some vars to point to new location after 
     192             * pool reset. 
     193             */ 
     194            op_key = &rdata->tp_info.op_key.op_key; 
     195        } 
    182196 
    183197        /* Read next packet. */ 
Note: See TracChangeset for help on using the changeset viewer.