Merge "res/res_ari: Fix null endpoint handle" into 16

This commit is contained in:
Joshua Colp 2018-11-19 09:37:32 -06:00 committed by Gerrit Code Review
commit 2d4146d005
1 changed files with 12 additions and 6 deletions

View File

@ -1748,18 +1748,24 @@ void ast_ari_channels_create(struct ast_variable *headers,
struct ast_format_cap *request_cap;
struct ast_channel *originator;
chan_data = ast_calloc(1, sizeof(*chan_data));
if (!chan_data) {
ast_ari_response_alloc_failed(response);
return;
}
if (!ast_strlen_zero(args->originator) && !ast_strlen_zero(args->formats)) {
ast_ari_response_error(response, 400, "Bad Request",
"Originator and formats can't both be specified");
return;
}
if (ast_strlen_zero(args->endpoint)) {
ast_ari_response_error(response, 400, "Bad Request",
"Endpoint must be specified");
return;
}
chan_data = ast_calloc(1, sizeof(*chan_data));
if (!chan_data) {
ast_ari_response_alloc_failed(response);
return;
}
chan_data->stasis_stuff = ast_str_create(32);
if (!chan_data->stasis_stuff) {
ast_ari_response_alloc_failed(response);