[asterisk-commits] rmudgett: branch 13 r434508 - /branches/13/bridges/bridge_native_rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 9 10:54:07 CDT 2015


Author: rmudgett
Date: Thu Apr  9 10:54:05 2015
New Revision: 434508

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434508
Log:
bridge_native_rtp.c: Defer allocation and check if it fails in native_rtp_bridge_compatible().

Review: https://reviewboard.asterisk.org/r/4601/

Modified:
    branches/13/bridges/bridge_native_rtp.c

Modified: branches/13/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/bridges/bridge_native_rtp.c?view=diff&rev=434508&r1=434507&r2=434508
==============================================================================
--- branches/13/bridges/bridge_native_rtp.c (original)
+++ branches/13/bridges/bridge_native_rtp.c Thu Apr  9 10:54:05 2015
@@ -310,8 +310,8 @@
 	RAII_VAR(struct ast_rtp_instance *, instance1, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_rtp_instance *, vinstance0, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_rtp_instance *, vinstance1, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT), ao2_cleanup);
-	RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT), ao2_cleanup);
+	RAII_VAR(struct ast_format_cap *, cap0, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_format_cap *, cap1, NULL, ao2_cleanup);
 	int read_ptime0, read_ptime1, write_ptime0, write_ptime1;
 
 	/* We require two channels before even considering native bridging */
@@ -358,6 +358,12 @@
 			!ast_rtp_instance_get_engine(instance0)->dtmf_compatible(bc0->chan, instance0, bc1->chan, instance1)))) {
 		ast_debug(1, "Bridge '%s' can not use local native RTP bridge as local bridge or DTMF is not compatible\n",
 			bridge->uniqueid);
+		return 0;
+	}
+
+	cap0 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+	cap1 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+	if (!cap0 || !cap1) {
 		return 0;
 	}
 




More information about the asterisk-commits mailing list