提交 aa440200 authored 作者: Mike Jerris's avatar Mike Jerris

Merge pull request #665 in FS/freeswitch from ~CXREG/freeswitch-8721:master to master

* commit '7020d21e':
  FS-8721: avoid memory leak when removing thread-locked bugs
...@@ -1095,7 +1095,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess ...@@ -1095,7 +1095,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch_core_session_t *session, const char *function) SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch_core_session_t *session, const char *function)
{ {
switch_media_bug_t *bp; switch_media_bug_t *bp, *last = NULL;
switch_status_t status = SWITCH_STATUS_FALSE; switch_status_t status = SWITCH_STATUS_FALSE;
if (session->bugs) { if (session->bugs) {
...@@ -1116,8 +1116,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch ...@@ -1116,8 +1116,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch
} }
switch_core_media_bug_destroy(bp); switch_core_media_bug_destroy(bp);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Removing BUG from %s\n", switch_channel_get_name(session->channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Removing BUG from %s\n", switch_channel_get_name(session->channel));
if (last) {
last->next = bp->next;
} else {
session->bugs = bp->next;
}
last = bp;
} }
session->bugs = NULL;
switch_thread_rwlock_unlock(session->bug_rwlock); switch_thread_rwlock_unlock(session->bug_rwlock);
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论