From 8046beba836b0e54b6d0a98d8299c38dd3f898dc Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 20 Nov 2009 02:15:49 +0000 Subject: [PATCH] fix bv codecs git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15564 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/codecs/mod_bv/mod_bv.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/mod/codecs/mod_bv/mod_bv.c b/src/mod/codecs/mod_bv/mod_bv.c index 70057379f3..a3e3d9e239 100644 --- a/src/mod/codecs/mod_bv/mod_bv.c +++ b/src/mod/codecs/mod_bv/mod_bv.c @@ -54,11 +54,11 @@ static switch_status_t switch_bv16_init(switch_codec_t *codec, switch_codec_flag } if (encoding) { - bv16_encode_init(context->encoder_object); + context->encoder_object = bv16_encode_init(NULL); } if (decoding) { - bv16_decode_init(context->decoder_object); + context->decoder_object = bv16_decode_init(NULL); } codec->private_info = context; @@ -67,6 +67,16 @@ static switch_status_t switch_bv16_init(switch_codec_t *codec, switch_codec_flag static switch_status_t switch_bv16_destroy(switch_codec_t *codec) { + struct bv16_context *context = codec->private_info; + + if (context->encoder_object) { + bv16_encode_free(context->encoder_object); + } + + if (context->decoder_object) { + bv16_decode_free(context->decoder_object); + } + codec->private_info = NULL; return SWITCH_STATUS_SUCCESS; } @@ -127,11 +137,11 @@ static switch_status_t switch_bv32_init(switch_codec_t *codec, switch_codec_flag } if (encoding) { - bv32_encode_init(context->encoder_object); + context->encoder_object = bv32_encode_init(NULL); } if (decoding) { - bv32_decode_init(context->decoder_object); + context->decoder_object = bv32_decode_init(NULL); } codec->private_info = context; @@ -140,7 +150,19 @@ static switch_status_t switch_bv32_init(switch_codec_t *codec, switch_codec_flag static switch_status_t switch_bv32_destroy(switch_codec_t *codec) { + struct bv32_context *context = codec->private_info; + + if (context->encoder_object) { + bv32_encode_free(context->encoder_object); + } + + if (context->decoder_object) { + bv32_decode_free(context->decoder_object); + } + codec->private_info = NULL; + + return SWITCH_STATUS_SUCCESS; }