diff --git a/src/switch_channel.c b/src/switch_channel.c index 7bf7571d75..b6ed57115a 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -485,7 +485,7 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname) { - const char *v = NULL; + const char *v = NULL, *r = NULL; switch_assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); @@ -507,17 +507,17 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *chann } } - if (v) v = switch_core_session_strdup(channel->session, v); + if (v) r = switch_core_session_strdup(channel->session, v); switch_mutex_unlock(channel->profile_mutex); - return v; + return r; } SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname) { const char *uuid; - const char *val = NULL; + const char *val = NULL, *r = NULL; switch_assert(channel != NULL); if (!switch_strlen_zero(varname)) { @@ -531,9 +531,9 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_ } } - if (val) val = switch_core_session_strdup(channel->session, val); + if (val) r = switch_core_session_strdup(channel->session, val); - return val; + return r; } diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index d16e1159c5..395c6cadfd 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -569,11 +569,12 @@ switch_memory_pool_t *switch_core_memory_init(void) abort(); } - if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_DEFAULT, memory_manager.memory_pool)) != APR_SUCCESS) { + if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, memory_manager.memory_pool)) != APR_SUCCESS) { abort(); } apr_allocator_mutex_set(my_allocator, my_mutex); + apr_pool_mutex_set(memory_manager.memory_pool, my_mutex); apr_allocator_owner_set(my_allocator, memory_manager.memory_pool); #else apr_pool_create(&memory_manager.memory_pool, NULL);