From: Kinsey Moore Date: Fri, 12 Apr 2013 22:26:17 +0000 (+0000) Subject: Allow codec_resample to be unloaded X-Git-Tag: 13.0.0-beta1~1926 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=510b3b3594266fc96d3fa9342c8f968acc51d161;p=thirdparty%2Fasterisk.git Allow codec_resample to be unloaded Ensure that trans_size is correct to prevent uninitialized entries from preventing reload. (closes issue ASTERISK-21401) Reported by: Corey Farrell Tested by: Corey Farrell Patches: codec_resample-unload.patch uploaded by Corey Farrell ........ Merged revisions 385582 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385585 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/codecs/codec_resample.c b/codecs/codec_resample.c index 7e3bfcb45f..29d95a7987 100644 --- a/codecs/codec_resample.c +++ b/codecs/codec_resample.c @@ -113,7 +113,7 @@ static int load_module(void) int res = 0; int x, y, idx = 0; - trans_size = ARRAY_LEN(id_list) * ARRAY_LEN(id_list); + trans_size = ARRAY_LEN(id_list) * (ARRAY_LEN(id_list) - 1); if (!(translators = ast_calloc(1, sizeof(struct ast_translator) * trans_size))) { return AST_MODULE_LOAD_FAILURE; }