[asterisk-commits] file: branch 1.6.0 r228415 - /branches/1.6.0/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 6 10:56:43 CST 2009


Author: file
Date: Fri Nov  6 10:56:37 2009
New Revision: 228415

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=228415
Log:
Fix a crash caused by freeing a dialog directly instead of using dialog_unref.

(closes issue #16097)
Reported by: steinwej
Patches:
      no_RTP.diff uploaded by steinwej (license 841)

Modified:
    branches/1.6.0/channels/chan_sip.c

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=228415&r1=228414&r2=228415
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Fri Nov  6 10:56:37 2009
@@ -6218,7 +6218,7 @@
 		return NULL;
 
 	if (ast_string_field_init(p, 512)) {
-		ast_free(p);
+		dialog_unref(p);
 		return NULL;
 	}
 
@@ -6278,27 +6278,12 @@
 			p->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr);
 			p->t38_maxdatagram = global_t38_maxdatagram;
 		}
- 		if (!p->rtp|| (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) && !p->vrtp) 
+ 		if (p->rtp|| (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) && !p->vrtp) 
 				|| (ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT) && !p->trtp)) {
  			ast_log(LOG_WARNING, "Unable to create RTP audio %s%ssession: %s\n",
  				ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) ? "and video " : "",
  				ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT) ? "and text " : "", strerror(errno));
-			if (p->rtp) {
-				ast_rtp_destroy(p->rtp);
-			}
-			if (p->vrtp) {
-				ast_rtp_destroy(p->vrtp);
-			}
-			if (p->udptl) {
-				ast_udptl_destroy(p->udptl);
-			}
-			ast_mutex_destroy(&p->pvt_lock);
-			if (p->chanvars) {
-				ast_variables_destroy(p->chanvars);
-				p->chanvars = NULL;
-			}
-			ast_string_field_free_memory(p);
-			ast_free(p);
+			dialog_unref(p);
 			return NULL;
 		}
 		ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio, "SIP RTP");




More information about the asterisk-commits mailing list