diff --git a/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c b/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c index 1cd355683e..a73bb0daf8 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c @@ -287,6 +287,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg, component = switch_core_alloc(pool, sizeof(*component)); component = CPA_COMPONENT(rayo_component_init((struct rayo_component *)component, pool, RAT_CALL_COMPONENT, "cpa", NULL, call, iks_find_attrib(iq, "from"))); if (!component) { + switch_core_destroy_memory_pool(&pool); return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create CPA entity"); } diff --git a/src/mod/event_handlers/mod_rayo/rayo_output_component.c b/src/mod/event_handlers/mod_rayo/rayo_output_component.c index 1817a5f342..c713450fd1 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_output_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_output_component.c @@ -69,20 +69,19 @@ static struct rayo_component *create_output_component(struct rayo_actor *actor, switch_core_new_memory_pool(&pool); output_component = switch_core_alloc(pool, sizeof(*output_component)); output_component = OUTPUT_COMPONENT(rayo_component_init((struct rayo_component *)output_component, pool, type, "output", NULL, actor, client_jid)); - if (!output_component) { + if (output_component) { + output_component->document = iks_copy(output); + output_component->start_offset_ms = iks_find_int_attrib(output, "start-offset"); + output_component->repeat_interval_ms = iks_find_int_attrib(output, "repeat-interval"); + output_component->repeat_times = iks_find_int_attrib(output, "repeat-times"); + output_component->max_time_ms = iks_find_int_attrib(output, "max-time"); + output_component->start_paused = iks_find_bool_attrib(output, "start-paused"); + output_component->renderer = iks_find_attrib(output, "renderer"); + } else { switch_core_destroy_memory_pool(&pool); - return NULL; } - output_component->document = iks_copy(output); - output_component->start_offset_ms = iks_find_int_attrib(output, "start-offset"); - output_component->repeat_interval_ms = iks_find_int_attrib(output, "repeat-interval"); - output_component->repeat_times = iks_find_int_attrib(output, "repeat-times"); - output_component->max_time_ms = iks_find_int_attrib(output, "max-time"); - output_component->start_paused = iks_find_bool_attrib(output, "start-paused"); - output_component->renderer = iks_find_attrib(output, "renderer"); - - return (struct rayo_component *)output_component; + return RAYO_COMPONENT(output_component); } /** diff --git a/src/mod/event_handlers/mod_rayo/rayo_record_component.c b/src/mod/event_handlers/mod_rayo/rayo_record_component.c index 6e1b1484ef..1f3f3a6850 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_record_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_record_component.c @@ -170,22 +170,21 @@ static struct rayo_component *record_component_create(struct rayo_actor *actor, switch_core_new_memory_pool(&pool); record_component = switch_core_alloc(pool, sizeof(*record_component)); - record_component = RECORD_COMPONENT(rayo_component_init(RAYO_COMPONENT(record_component), pool, type, "record", fs_file_path, actor, client_jid)); - if (!record_component) { + record_component = RECORD_COMPONENT(rayo_component_init(RAYO_COMPONENT(record_component), pool, type, "record", fs_file_path, actor, client_jid));\ + if (record_component) { + record_component->max_duration = iks_find_int_attrib(record, "max-duration"); + record_component->initial_timeout = iks_find_int_attrib(record, "initial-timeout"); + record_component->final_timeout = iks_find_int_attrib(record, "final-timeout"); + record_component->direction = switch_core_strdup(RAYO_POOL(record_component), iks_find_attrib_soft(record, "direction")); + record_component->mix = iks_find_bool_attrib(record, "mix"); + record_component->start_beep = iks_find_bool_attrib(record, "start-beep"); + record_component->stop_beep = iks_find_bool_attrib(record, "stop-beep"); + record_component->start_time = start_paused ? 0 : switch_micro_time_now(); + record_component->local_file_path = switch_core_strdup(RAYO_POOL(record_component), local_file_path); + } else { switch_core_destroy_memory_pool(&pool); - return NULL; } - record_component->max_duration = iks_find_int_attrib(record, "max-duration"); - record_component->initial_timeout = iks_find_int_attrib(record, "initial-timeout"); - record_component->final_timeout = iks_find_int_attrib(record, "final-timeout"); - record_component->direction = switch_core_strdup(RAYO_POOL(record_component), iks_find_attrib_soft(record, "direction")); - record_component->mix = iks_find_bool_attrib(record, "mix"); - record_component->start_beep = iks_find_bool_attrib(record, "start-beep"); - record_component->stop_beep = iks_find_bool_attrib(record, "stop-beep"); - record_component->start_time = start_paused ? 0 : switch_micro_time_now(); - record_component->local_file_path = switch_core_strdup(RAYO_POOL(record_component), local_file_path); - switch_safe_free(local_file_path); switch_safe_free(fs_file_path);