From 514f4802c1325b13dcb516cf9265c12c58d7b760 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 22 Dec 2012 22:29:33 -0600 Subject: [PATCH] FS-4960 --resolve --- src/switch_core_session.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 3a2c08bcc3..b0073e670e 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1186,9 +1186,17 @@ SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_se if (session->private_event_queue) { while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue_pri, &pop)) == SWITCH_STATUS_SUCCESS) { + if (pop) { + switch_event_t *event = (switch_event_t *) pop; + switch_event_destroy(&event); + } x++; } while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) { + if (pop) { + switch_event_t *event = (switch_event_t *) pop; + switch_event_destroy(&event); + } x++; } check_media(session); @@ -1320,6 +1328,9 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * switch_endpoint_interface_t *endpoint_interface = (*session)->endpoint_interface; int i; + + switch_core_session_flush_private_events(*session); + if (switch_core_session_running(*session) && !switch_test_flag((*session), SSF_DESTROYABLE)) { switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(*session), SWITCH_LOG_ERROR, "Cowardly ignoring an attempt to call destroy on a running session.\n");