Changeset 4861


Ignore:
Timestamp:
Jun 19, 2014 8:06:50 AM (10 years ago)
Author:
nanang
Message:

Close #1772: Fixed error handling in pjsua_create() and pjsua_init().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r4860 r4861  
    798798    /* Init PJLIB-UTIL: */ 
    799799    status = pjlib_util_init(); 
    800     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
     800    if (status != PJ_SUCCESS) { 
     801        pj_log_pop_indent(); 
     802        pjsua_perror(THIS_FILE, "Failed in initializing pjlib-util", status); 
     803        pj_shutdown(); 
     804        return status; 
     805    } 
    801806 
    802807    /* Init PJNATH */ 
    803808    status = pjnath_init(); 
    804     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
     809    if (status != PJ_SUCCESS) { 
     810        pj_log_pop_indent(); 
     811        pjsua_perror(THIS_FILE, "Failed in initializing pjnath", status); 
     812        pj_shutdown(); 
     813        return status; 
     814    } 
    805815 
    806816    /* Set default sound device ID */ 
     
    817827    /* Create memory pool for application. */ 
    818828    pjsua_var.pool = pjsua_pool_create("pjsua", 1000, 1000); 
     829    if (pjsua_var.pool == NULL) { 
     830        pj_log_pop_indent(); 
     831        status = PJ_ENOMEM; 
     832        pjsua_perror(THIS_FILE, "Unable to create pjsua pool", status); 
     833        pj_shutdown(); 
     834        return status; 
     835    } 
    819836     
    820     PJ_ASSERT_RETURN(pjsua_var.pool, PJ_ENOMEM); 
    821  
    822837    /* Create mutex */ 
    823838    status = pj_mutex_create_recursive(pjsua_var.pool, "pjsua",  
     
    826841        pj_log_pop_indent(); 
    827842        pjsua_perror(THIS_FILE, "Unable to create mutex", status); 
     843        pjsua_destroy(); 
    828844        return status; 
    829845    } 
     
    835851                                pj_gethostname()->ptr,  
    836852                                &pjsua_var.endpt); 
    837     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
     853    if (status != PJ_SUCCESS) { 
     854        pj_log_pop_indent(); 
     855        pjsua_perror(THIS_FILE, "Unable to create endpoint", status); 
     856        pjsua_destroy(); 
     857        return status; 
     858    } 
    838859 
    839860    /* Init timer entry list */ 
     
    846867        pj_log_pop_indent(); 
    847868        pjsua_perror(THIS_FILE, "Unable to create mutex", status); 
     869        pjsua_destroy(); 
    848870        return status; 
    849871    } 
     
    11261148 
    11271149on_error: 
    1128     pjsua_destroy(); 
    11291150    pj_log_pop_indent(); 
    11301151    return status; 
Note: See TracChangeset for help on using the changeset viewer.