提交 cfd4d52d authored 作者: Jeff Lenk's avatar Jeff Lenk

fix memory alloc issue

上级 a15f51d5
...@@ -90,6 +90,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co ...@@ -90,6 +90,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
char *user_via = NULL; char *user_via = NULL;
char *contact_str = NULL; char *contact_str = NULL;
char *dup_dest = NULL; char *dup_dest = NULL;
char *remote_host = NULL;
if (!to) { if (!to) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n");
...@@ -185,11 +186,9 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co ...@@ -185,11 +186,9 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
/* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */ /* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */
remote_ip = malloc(sizeof(80));
dup_dest = strdup(dst->contact); dup_dest = strdup(dst->contact);
if (switch_stristr("fs_path", dst->contact)) { if (switch_stristr("fs_path", dst->contact)) {
char *remote_host = NULL;
const char *s; const char *s;
if ((s = switch_stristr("fs_path=", dst->contact))) { if ((s = switch_stristr("fs_path=", dst->contact))) {
...@@ -202,7 +201,6 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co ...@@ -202,7 +201,6 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
if (!zstr(remote_host)) { if (!zstr(remote_host)) {
switch_split_user_domain(remote_host, NULL, &remote_ip); switch_split_user_domain(remote_host, NULL, &remote_ip);
} }
switch_safe_free(remote_host);
} }
if (zstr(remote_ip)) { if (zstr(remote_ip)) {
...@@ -236,7 +234,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co ...@@ -236,7 +234,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
} }
switch_safe_free(dup_dest); switch_safe_free(dup_dest);
free(remote_ip); switch_safe_free(remote_host);
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论