提交 d2c69002 authored 作者: Anthony Minessale's avatar Anthony Minessale

fix mem leak in phrases

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16884 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 869948d3
...@@ -247,8 +247,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s ...@@ -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 ...@@ -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 ...@@ -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;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论