Ignore:
Timestamp:
Nov 21, 2006 12:39:31 PM (16 years ago)
Author:
bennylp
Message:

Fixed handles leak upon program exit, by introducing pj_shutdown() and pj_atexit(). Also fixed handle leaks in SIP transaction layer and SIP endpoint.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/pool_buf.c

    r768 r815  
    3030 
    3131static int is_initialized; 
    32 static long tls; 
     32static long tls = -1; 
    3333static void* stack_alloc(pj_pool_factory *factory, pj_size_t size); 
    3434 
    35 static pj_status_t initialize() 
     35static void pool_buf_cleanup(void) 
    3636{ 
     37    if (tls != -1) { 
     38        pj_thread_local_free(tls); 
     39        tls = -1; 
     40    } 
     41} 
     42 
     43static pj_status_t pool_buf_initialize() 
     44{ 
     45    pj_atexit(&pool_buf_cleanup); 
     46 
    3747    stack_based_factory.policy.block_alloc = &stack_alloc; 
    3848    return pj_thread_local_alloc(&tls); 
     
    6575 
    6676    if (!is_initialized) { 
    67         if (initialize() != PJ_SUCCESS) 
     77        if (pool_buf_initialize() != PJ_SUCCESS) 
    6878            return NULL; 
    6979        is_initialized = 1; 
Note: See TracChangeset for help on using the changeset viewer.