if (!(tmp->sched = sched_context_create())) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to create schedule context\n");
- ast_free(tmp);
- return NULL;
+ return ast_channel_unref(tmp);
}
if ((ast_string_field_init(tmp, 128))) {
- sched_context_destroy(tmp->sched);
- ast_free(tmp);
- return NULL;
+ return ast_channel_unref(tmp);
}
if (cid_name) {
if (!(tmp->cid.cid_name = ast_strdup(cid_name))) {
- ast_string_field_free_memory(tmp);
- sched_context_destroy(tmp->sched);
return ast_channel_unref(tmp);
}
}
if (cid_num) {
if (!(tmp->cid.cid_num = ast_strdup(cid_num))) {
- ast_string_field_free_memory(tmp);
- sched_context_destroy(tmp->sched);
return ast_channel_unref(tmp);
}
}