Author: mikej Date: Thu Jan 22 15:40:38 2009 New Revision: 11400 Log: mod_limit: fix memory corruption caused by race condition when using limit hash (r:11070-11071) Modified: freeswitch/branches/1.0/src/mod/applications/mod_limit/mod_limit.c Modified: freeswitch/branches/1.0/src/mod/applications/mod_limit/mod_limit.c ============================================================================== --- freeswitch/branches/1.0/src/mod/applications/mod_limit/mod_limit.c (original) +++ freeswitch/branches/1.0/src/mod/applications/mod_limit/mod_limit.c Thu Jan 22 15:40:38 2009 @@ -300,7 +300,7 @@ /* The call is either hung up, or is going back into the dialplan, decrement appropriate couters */ if (state == CS_HANGUP || state == CS_ROUTING) { switch_hash_index_t *hi; - switch_mutex_lock(globals.mutex); + switch_mutex_lock(globals.limit_hash_mutex); /* Loop through the channel's hashtable which contains mapping to all the limit_hash_item_t referenced by that channel */ for(hi = switch_hash_first(NULL, channel_hash); hi; hi = switch_hash_next(hi)) @@ -319,7 +319,7 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)key, item->total_usage); } switch_core_event_hook_remove_state_change(session, hash_state_handler); - switch_mutex_unlock(globals.mutex); + switch_mutex_unlock(globals.limit_hash_mutex); } return SWITCH_STATUS_SUCCESS;