[asterisk-commits] mjordan: branch 10 r349822 - /branches/10/res/res_fax.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 5 17:56:56 CST 2012


Author: mjordan
Date: Thu Jan  5 17:56:52 2012
New Revision: 349822

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=349822
Log:
Fix premature free'ing of the frame committed in r349608

Even though we set the frame to the ast_null_frame and return that,
the caller of the frame hook may still need the frame.  This now is
a bit more careful about when it frees the frame, i.e., only under
the same conditions that applied when we duplicated it in the first
place.

Modified:
    branches/10/res/res_fax.c

Modified: branches/10/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/res/res_fax.c?view=diff&rev=349822&r1=349821&r2=349822
==============================================================================
--- branches/10/res/res_fax.c (original)
+++ branches/10/res/res_fax.c Thu Jan  5 17:56:52 2012
@@ -3058,7 +3058,11 @@
 		 * write would fail, or even if a failure would be fatal so for
 		 * now we'll just ignore the return value. */
 		gateway->s->tech->write(gateway->s, f);
-		ast_frfree(f);
+		if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.format.id != AST_FORMAT_SLINEAR) && active->readtrans) {
+			/* Only free the frame if we translated / duplicated it - otherwise,
+			 * let whatever is outside the frame hook do it */
+			ast_frfree(f);
+		}
 		f = &ast_null_frame;
 		ao2_ref(details, -1);
 		return f;




More information about the asterisk-commits mailing list