fix possible bad pointer in global vars (please test)

This commit is contained in:
Anthony Minessale committed 2011-02-02 15:43:26 -06:00
1 parent 89c5f3bf82
commit 4ae8282e6c
26 files changed
+185 -100

No files matched your search

+8 -2
View File
@@ -1154,8 +1154,8 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *base;
const char *force_local_ip_v4 = switch_core_get_variable("force_local_ip_v4");
const char *force_local_ip_v6 = switch_core_get_variable("force_local_ip_v6");
char *force_local_ip_v4 = switch_core_get_variable_dup("force_local_ip_v4");
char *force_local_ip_v6 = switch_core_get_variable_dup("force_local_ip_v6");
#ifdef WIN32
SOCKET tmp_socket;
@@ -1176,14 +1176,20 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
case AF_INET:
if (force_local_ip_v4) {
switch_copy_string(buf, force_local_ip_v4, len);
switch_safe_free(force_local_ip_v4);
switch_safe_free(force_local_ip_v6);
return SWITCH_STATUS_SUCCESS;
}
case AF_INET6:
if (force_local_ip_v6) {
switch_copy_string(buf, force_local_ip_v6, len);
switch_safe_free(force_local_ip_v4);
switch_safe_free(force_local_ip_v6);
return SWITCH_STATUS_SUCCESS;
}
default:
switch_safe_free(force_local_ip_v4);
switch_safe_free(force_local_ip_v6);
break;
}