[asterisk-commits] russell: branch 1.4 r99081 - in /branches/1.4: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 18 15:37:22 CST 2008


Author: russell
Date: Fri Jan 18 15:37:21 2008
New Revision: 99081

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99081
Log:
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)

Modified:
    branches/1.4/include/asterisk/translate.h
    branches/1.4/main/frame.c

Modified: branches/1.4/include/asterisk/translate.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/translate.h?view=diff&rev=99081&r1=99080&r2=99081
==============================================================================
--- branches/1.4/include/asterisk/translate.h (original)
+++ branches/1.4/include/asterisk/translate.h Fri Jan 18 15:37:21 2008
@@ -149,7 +149,7 @@
 	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,

Modified: branches/1.4/main/frame.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/frame.c?view=diff&rev=99081&r1=99080&r2=99081
==============================================================================
--- branches/1.4/main/frame.c (original)
+++ branches/1.4/main/frame.c Fri Jan 18 15:37:21 2008
@@ -334,6 +334,9 @@
 
 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 @@
 #endif			
 		free(fr);
 	}
-
-	if (ast_test_flag(fr, AST_FRFLAG_FROM_TRANSLATOR))
-		ast_translate_frame_freed(fr);
 }
 
 /*!




More information about the asterisk-commits mailing list