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_transport.c

    r2180 r2380  
    569569    /* Allocate buffer if necessary. */ 
    570570    if (tdata->buf.start == NULL) { 
    571         tdata->buf.start = (char*)  
    572                            pj_pool_alloc( tdata->pool, PJSIP_MAX_PKT_LEN); 
     571        PJ_USE_EXCEPTION; 
     572 
     573        PJ_TRY { 
     574            tdata->buf.start = (char*)  
     575                               pj_pool_alloc(tdata->pool, PJSIP_MAX_PKT_LEN); 
     576        } 
     577        PJ_CATCH_ANY { 
     578            return PJ_ENOMEM; 
     579        } 
     580        PJ_END 
     581 
    573582        tdata->buf.cur = tdata->buf.start; 
    574583        tdata->buf.end = tdata->buf.start + PJSIP_MAX_PKT_LEN; 
Note: See TracChangeset for help on using the changeset viewer.