gracefully handle allocation failure

This commit is contained in:
Michael Jerris 2014-04-30 08:55:39 -04:00
parent 2e8572acb5
commit e98045841e
1 changed files with 6 additions and 0 deletions

View File

@ -624,6 +624,12 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa
switch_memory_pool_t *pool = cbt->pool;
additional = switch_core_alloc(pool, sizeof(lcr_obj_t));
if (!additional) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating in route_add_callback\n");
goto end;
}
switch_event_create(&additional->fields, SWITCH_EVENT_REQUEST_PARAMS);
for (i = 0; i < argc ; i++) {