[asterisk-commits] file: branch file/rtp_engine r143562 - /team/file/rtp_engine/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 18 19:08:21 CDT 2008
Author: file
Date: Thu Sep 18 19:08:20 2008
New Revision: 143562
URL: http://svn.digium.com/view/asterisk?view=rev&rev=143562
Log:
Bail out if we are unable to allocate an RTP instance.
Modified:
team/file/rtp_engine/channels/chan_sip.c
Modified: team/file/rtp_engine/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/file/rtp_engine/channels/chan_sip.c?view=diff&rev=143562&r1=143561&r2=143562
==============================================================================
--- team/file/rtp_engine/channels/chan_sip.c (original)
+++ team/file/rtp_engine/channels/chan_sip.c Thu Sep 18 19:08:20 2008
@@ -6009,15 +6009,30 @@
p->ocseq = INITIAL_CSEQ;
if (sip_methods[intended_method].need_rtp) {
- p->rtp = ast_rtp_instance_new(NULL, sched, &bindaddr);
+ if (!(p->rtp = ast_rtp_instance_new(NULL, sched, &bindaddr))) {
+ ao2_t_ref(p, -1, "failed to allocate voice RTP instance, drop p");
+ ast_string_field_free_memory(p);
+ ast_free(p);
+ return NULL;
+ }
ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_RTCP, 1);
/* If the global videosupport flag is on, we always create a RTP interface for video */
if (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT)) {
- p->vrtp = ast_rtp_instance_new(NULL, sched, &bindaddr);
+ if (!(p->vrtp = ast_rtp_instance_new(NULL, sched, &bindaddr))) {
+ ao2_t_ref(p, -1, "failed to allocate video RTP instance, drop p");
+ ast_string_field_free_memory(p);
+ ast_free(p);
+ return NULL;
+ }
ast_rtp_instance_set_prop(p->vrtp, AST_RTP_PROPERTY_RTCP, 1);
}
if (ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT)) {
- p->trtp = ast_rtp_instance_new(NULL, sched, &bindaddr);
+ if (!(p->trtp = ast_rtp_instance_new(NULL, sched, &bindaddr))) {
+ ao2_t_ref(p, -1, "failed to allocate text RTP instance, drop p");
+ ast_string_field_free_memory(p);
+ ast_free(p);
+ return NULL;
+ }
ast_rtp_instance_set_prop(p->trtp, AST_RTP_PROPERTY_RTCP, 1);
}
if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT))
More information about the asterisk-commits
mailing list