Merge pull request #733 in FS/freeswitch from ~TCSEKE/freeswitch:bugfix/FS-8866-mod_erlang_event-memleak to master

* commit '0914a501cd315fc2b397cf7dd4a296e36eb7a051':
  Fix memory leaks
This commit is contained in:
Mike Jerris 2016-03-09 11:26:36 -06:00
commit a5a5cc47b4
1 changed files with 8 additions and 0 deletions

View File

@ -382,6 +382,7 @@ static void remove_session_elem_from_listener(listener_t *listener, session_elem
static void destroy_session_elem(session_elem_t *session_element)
{
switch_core_session_t *session;
void *pop;
/* wait for readers */
switch_thread_rwlock_wrlock(session_element->rwlock);
@ -395,6 +396,13 @@ static void destroy_session_elem(session_elem_t *session_element)
switch_core_session_soft_unlock(session);
switch_core_session_rwunlock(session);
}
while (switch_queue_trypop(session_element->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_event_t *event = (switch_event_t *) pop;
switch_event_destroy(&event);
}
switch_core_hash_destroy(&session_element->event_hash);
switch_core_destroy_memory_pool(&session_element->pool);
}