From: Russell Bryant Date: Fri, 18 Jan 2008 21:38:01 +0000 (+0000) Subject: Merged revisions 99081 via svnmerge from X-Git-Tag: 1.6.0-beta1~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1807acb9b0a4bed6ec1ad8f7b713663bfccf5447;p=thirdparty%2Fasterisk.git Merged revisions 99081 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r99081 | russell | 2008-01-18 15:37:21 -0600 (Fri, 18 Jan 2008) | 9 lines Revert adding the packed attribute, as it really doesn't make sense why that would do any good. Fix the real bug, which is to do the check to see if the frame came from a translator at the beginning of ast_frame_free(), instead of at the end. This ensures that it always gets checked, even if none of the parts of the frame are malloc'd, and also ensures that we aren't looking at free'd memory in the case that it is a malloc'd frame. (closes issue #11792, reported by explidous, patched by me) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99082 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h index f4673944c7..97f10283f3 100644 --- a/include/asterisk/translate.h +++ b/include/asterisk/translate.h @@ -147,7 +147,7 @@ struct ast_trans_pvt { struct timeval nextin; struct timeval nextout; unsigned int destroy:1; -} attribute_packed; +}; /*! \brief generic frameout function */ struct ast_frame *ast_trans_frameout(struct ast_trans_pvt *pvt, diff --git a/main/frame.c b/main/frame.c index d46dd239c2..3100636c53 100644 --- a/main/frame.c +++ b/main/frame.c @@ -321,6 +321,9 @@ static void frame_cache_cleanup(void *data) void ast_frame_free(struct ast_frame *fr, int cache) { + if (ast_test_flag(fr, AST_FRFLAG_FROM_TRANSLATOR)) + ast_translate_frame_freed(fr); + if (!fr->mallocd) return; @@ -356,9 +359,6 @@ void ast_frame_free(struct ast_frame *fr, int cache) #endif ast_free(fr); } - - if (ast_test_flag(fr, AST_FRFLAG_FROM_TRANSLATOR)) - ast_translate_frame_freed(fr); } /*!