fix leak when call hangs up or other error condition while saying an ip address (add mod_say_zh to windows build)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9184 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris committed 2008-07-28 16:13:52 +00:00
1 parent 423275120c
commit 7f5211b40d
9 files changed
+78 -112

No files matched your search

+5 -11
View File
@@ -236,28 +236,24 @@ static switch_status_t de_say_general_count(switch_core_session_t *session,
static switch_status_t de_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a, *b, *c, *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(a = strdup(tosay))) {
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*d++ = '\0';
@@ -270,9 +266,7 @@ static switch_status_t de_ip(switch_core_session_t *session, char *tosay, switch
say_file("digits/dot.wav");
say_num(atoi(d), method);
done:
switch_safe_free(a);
return status;
return SWITCH_STATUS_SUCCESS;
}
+5 -11
View File
@@ -225,28 +225,24 @@ static switch_status_t en_say_general_count(switch_core_session_t *session,
static switch_status_t en_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a, *b, *c, *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(a = strdup(tosay))) {
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*d++ = '\0';
@@ -259,9 +255,7 @@ static switch_status_t en_ip(switch_core_session_t *session, char *tosay, switch
say_file("digits/dot.wav");
say_num(atoi(d), method);
done:
switch_safe_free(a);
return status;
return SWITCH_STATUS_SUCCESS;
}
+5 -11
View File
@@ -225,28 +225,24 @@ static switch_status_t es_say_general_count(switch_core_session_t *session,
static switch_status_t es_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a, *b, *c, *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(a = strdup(tosay))) {
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*d++ = '\0';
@@ -259,9 +255,7 @@ static switch_status_t es_ip(switch_core_session_t *session, char *tosay, switch
say_file("digits/dot.wav");
say_num(atoi(d), method);
done:
switch_safe_free(a);
return status;
return SWITCH_STATUS_SUCCESS;
}
+5 -11
View File
@@ -225,28 +225,24 @@ static switch_status_t fr_say_general_count(switch_core_session_t *session,
static switch_status_t fr_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a, *b, *c, *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(a = strdup(tosay))) {
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*d++ = '\0';
@@ -259,9 +255,7 @@ static switch_status_t fr_ip(switch_core_session_t *session, char *tosay, switch
say_file("digits/dot.wav");
say_num(atoi(d), method);
done:
switch_safe_free(a);
return status;
return SWITCH_STATUS_SUCCESS;
}
+5 -11
View File
@@ -225,28 +225,24 @@ static switch_status_t it_say_general_count(switch_core_session_t *session,
static switch_status_t it_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a, *b, *c, *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(a = strdup(tosay))) {
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*d++ = '\0';
@@ -259,9 +255,7 @@ static switch_status_t it_ip(switch_core_session_t *session, char *tosay, switch
say_file("digits/dot.wav");
say_num(atoi(d), method);
done:
switch_safe_free(a);
return status;
return SWITCH_STATUS_SUCCESS;
}
+5 -11
View File
@@ -225,28 +225,24 @@ static switch_status_t nl_say_general_count(switch_core_session_t *session,
static switch_status_t nl_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a, *b, *c, *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(a = strdup(tosay))) {
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
return SWITCH_STATUS_FALSE;
}
*d++ = '\0';
@@ -259,9 +255,7 @@ static switch_status_t nl_ip(switch_core_session_t *session, char *tosay, switch
say_file("digits/dot.wav");
say_num(atoi(d), method);
done:
switch_safe_free(a);
return status;
return SWITCH_STATUS_SUCCESS;
}
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="9.00"
Name="mod_say_zh"
ProjectGUID="{988CACF7-3FCB-4992-BE69-77872AE67DC8}"
ProjectGUID="{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}"
RootNamespace="mod_say_zh"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
+35 -45
View File
@@ -290,51 +290,41 @@ static switch_status_t zh_say_general_count(switch_core_session_t *session,
}
static switch_status_t zh_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a;
char *b;
char *c;
char *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(a = strdup(tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
status = SWITCH_STATUS_FALSE;
goto done;
}
*d++ = '\0';
say_num(atoi(a), method);
say_file("digits/dot.wav");
say_num(atoi(b), method);
say_file("digits/dot.wav");
say_num(atoi(c), method);
say_file("digits/dot.wav");
say_num(atoi(d), method);
done:
switch_safe_free(a);
return status;
}
static switch_status_t zh_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
}
if (!(b = strchr(a, '.'))) {
return SWITCH_STATUS_FALSE;
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
return SWITCH_STATUS_FALSE;
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
return SWITCH_STATUS_FALSE;
}
*d++ = '\0';
say_num(atoi(a), method);
say_file("digits/dot.wav");
say_num(atoi(b), method);
say_file("digits/dot.wav");
say_num(atoi(c), method);
say_file("digits/dot.wav");
say_num(atoi(d), method);
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t zh_say_time(switch_core_session_t *session,
char *tosay,