fix mem leak in phrases
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16884 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
869948d333
commit
d2c6900240
|
@ -247,8 +247,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
||||||
char *adata = (char *) switch_xml_attr_soft(action, "data");
|
char *adata = (char *) switch_xml_attr_soft(action, "data");
|
||||||
char *func = (char *) switch_xml_attr_soft(action, "function");
|
char *func = (char *) switch_xml_attr_soft(action, "function");
|
||||||
|
|
||||||
if (strchr(pattern, '(') && strchr(adata, '$')) {
|
if (strchr(pattern, '(') && strchr(adata, '$') && proceed > 0) {
|
||||||
len = (uint32_t) (strlen(data) + strlen(adata) + 10) * (proceed ? proceed : 1);
|
len = (uint32_t) (strlen(data) + strlen(adata) + 10) * proceed;
|
||||||
if (!(substituted = malloc(len))) {
|
if (!(substituted = malloc(len))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Memory Error!\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Memory Error!\n");
|
||||||
switch_regex_safe_free(re);
|
switch_regex_safe_free(re);
|
||||||
|
@ -287,12 +287,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
cmd = switch_core_session_strdup(session, odata);
|
cmd = switch_core_session_strdup(session, odata);
|
||||||
|
|
||||||
if (!cmd) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Allocation error calling execute\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd_args = switch_separate_paren_args(cmd);
|
cmd_args = switch_separate_paren_args(cmd);
|
||||||
|
|
||||||
if (!cmd_args) {
|
if (!cmd_args) {
|
||||||
|
@ -336,14 +330,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_ivr_sleep(session, pause, SWITCH_FALSE, NULL);
|
switch_ivr_sleep(session, pause, SWITCH_FALSE, NULL);
|
||||||
|
switch_safe_free(expanded);
|
||||||
|
switch_safe_free(substituted);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_regex_safe_free(re);
|
switch_regex_safe_free(re);
|
||||||
switch_safe_free(expanded);
|
|
||||||
switch_safe_free(substituted);
|
|
||||||
|
|
||||||
|
|
||||||
if ((match && do_break && switch_true(do_break)) || status == SWITCH_STATUS_BREAK) {
|
if ((match && do_break && switch_true(do_break)) || status == SWITCH_STATUS_BREAK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue