diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 7bfe0186f6..c36149c0a5 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2814,11 +2814,13 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_ static int switch_ivr_set_xml_chan_var(switch_xml_t xml, const char *var, const char *val, int off) { char *data; - switch_size_t dlen = strlen(val) * 3 + 1; + switch_size_t dlen; switch_xml_t variable; if (!val) val = ""; + dlen = strlen(val) * 3 + 1; + if (!zstr(var) && ((variable = switch_xml_add_child_d(xml, var, off++)))) { if ((data = malloc(dlen))) { memset(data, 0, dlen); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 3c1771682b..99c70991bd 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1309,7 +1309,7 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st } } - if (oglobals->session && (read_codec = switch_core_session_get_read_codec(oglobals->session))) { + if ((read_codec = switch_core_session_get_read_codec(oglobals->session))) { if (ringback_data && switch_is_file_path(ringback_data)) { if (!(strrchr(ringback_data, '.') || strstr(ringback_data, SWITCH_URL_SEPARATOR))) { ringback->asis++;