Ignore:
Timestamp:
Feb 16, 2007 9:44:36 PM (18 years ago)
Author:
bennylp
Message:

Fixed ticket #105: unnecessary assert in fixed buffer based pool (pool_buf) on no memory condition

File:
1 edited

Legend:

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

    r839 r953  
    5454{ 
    5555    struct creation_param *param; 
     56    void *buf; 
    5657 
    5758    PJ_UNUSED_ARG(factory); 
    5859 
    5960    param = pj_thread_local_get(tls); 
    60     PJ_ASSERT_RETURN(param != NULL, NULL); 
     61    if (param == NULL) { 
     62        /* Don't assert(), this is normal no-memory situation */ 
     63        return NULL; 
     64    } 
    6165 
    6266    pj_thread_local_set(tls, NULL); 
     
    6468    PJ_ASSERT_RETURN(size <= param->size, NULL); 
    6569 
    66     return param->stack_buf; 
     70    buf = param->stack_buf; 
     71 
     72    /* Prevent the buffer from being reused */ 
     73    param->stack_buf = NULL; 
     74 
     75    return buf; 
    6776} 
    6877 
Note: See TracChangeset for help on using the changeset viewer.