]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Revert adding the packed attribute, as it really doesn't make sense why that
authorRussell Bryant <russell@russellbryant.com>
Fri, 18 Jan 2008 21:37:21 +0000 (21:37 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 18 Jan 2008 21:37:21 +0000 (21:37 +0000)
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/branches/1.4@99081 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/translate.h
main/frame.c

index 9437fa4e9a711070e76eea64cd5ca810d8a1a9ef..a81d0072ac164a9f96ff5866f7fde367ead5da85 100644 (file)
@@ -149,7 +149,7 @@ struct ast_trans_pvt {
        struct ast_trans_pvt *next;     /*!< next in translator chain */
        struct timeval nextin;
        struct timeval nextout;
-} attribute_packed;
+};
 
 /*! \brief generic frameout function */
 struct ast_frame *ast_trans_frameout(struct ast_trans_pvt *pvt,
index 9ac309fa31dbb30d8de2c9f1a1fef22881be8a0d..1dafce9f8497466d2b536966a27f8338672ab50d 100644 (file)
@@ -334,6 +334,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;
 
@@ -369,9 +372,6 @@ void ast_frame_free(struct ast_frame *fr, int cache)
 #endif                 
                free(fr);
        }
-
-       if (ast_test_flag(fr, AST_FRFLAG_FROM_TRANSLATOR))
-               ast_translate_frame_freed(fr);
 }
 
 /*!