From 7e61b16d6b9cfb5a5603a5681af12df41f8dd3ef Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Apr 2009 16:06:30 +0000 Subject: [PATCH] destroy codec git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12936 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_loopback/mod_loopback.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index e92aabf435..ea30957e3f 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -113,10 +113,12 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses if (tech_pvt->read_codec.implementation) { switch_core_codec_destroy(&tech_pvt->read_codec); + memset(&tech_pvt->read_codec, 0, sizeof(tech_pvt->read_codec)); } if (tech_pvt->write_codec.implementation) { switch_core_codec_destroy(&tech_pvt->write_codec); + memset(&tech_pvt->write_codec, 0, sizeof(tech_pvt->write_codec)); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d\n", switch_channel_get_name(channel), iananame, rate, interval); @@ -366,6 +368,16 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) switch_core_timer_destroy(&tech_pvt->timer); + if (tech_pvt->read_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->read_codec); + memset(&tech_pvt->read_codec, 0, sizeof(tech_pvt->read_codec)); + } + + if (tech_pvt->write_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->write_codec); + memset(&tech_pvt->write_codec, 0, sizeof(tech_pvt->write_codec)); + } + return SWITCH_STATUS_SUCCESS; }