FS-10236: [core] fix crash on hangup with multiple media bugs
This commit is contained in:
parent
f17ac2feb2
commit
4a280c70e4
|
@ -1216,13 +1216,15 @@ 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, *last = NULL;
|
switch_media_bug_t *bp, *last = NULL, *next = NULL;
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
switch_media_bug_t *closed = NULL;
|
switch_media_bug_t *closed = NULL;
|
||||||
|
|
||||||
if (session->bugs) {
|
if (session->bugs) {
|
||||||
switch_thread_rwlock_wrlock(session->bug_rwlock);
|
switch_thread_rwlock_wrlock(session->bug_rwlock);
|
||||||
for (bp = session->bugs; bp; bp = bp->next) {
|
for (bp = session->bugs; bp; bp = next) {
|
||||||
|
next = bp->next;
|
||||||
|
|
||||||
if (!switch_test_flag(session, SSF_DESTROYABLE) &&
|
if (!switch_test_flag(session, SSF_DESTROYABLE) &&
|
||||||
((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK))) {
|
((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BUG is thread locked skipping.\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BUG is thread locked skipping.\n");
|
||||||
|
|
Loading…
Reference in New Issue