[asterisk-commits] russell: branch 1.4 r88768 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 5 15:33:57 CST 2007


Author: russell
Date: Mon Nov  5 15:33:56 2007
New Revision: 88768

URL: http://svn.digium.com/view/asterisk?view=rev&rev=88768
Log:
When traversing the list of channel variables here in transmit_invite(), the 
asterisk channel must be locked, as this data may change at any time.

(I have seen numerous reports of crashes related to the handling of channel
variables.  There are a couple of issues on the bug tracker related to it,
but it has also been noted on IRC and mailing lists.  So, I am finding and
fixing some places where channel variables are handled improperly.) 

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=88768&r1=88767&r2=88768
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Mon Nov  5 15:33:56 2007
@@ -6954,8 +6954,12 @@
 	add_header(&req, "Allow", ALLOWED_METHODS);
 	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
 	if (p->options && p->options->addsipheaders && p->owner) {
-		struct ast_channel *ast = p->owner; /* The owner channel */
-		struct varshead *headp = &ast->varshead;
+		struct ast_channel *chan = p->owner; /* The owner channel */
+		struct varshead *headp;
+	
+		ast_channel_lock(chan);
+
+		headp = &chan->varshead;
 
 		if (!headp)
 			ast_log(LOG_WARNING,"No Headp for the channel...ooops!\n");
@@ -6986,6 +6990,8 @@
 				}
 			}
 		}
+
+		ast_channel_unlock(chan);
 	}
 	if (sdp) {
 		if (p->udptl && p->t38.state == T38_LOCAL_DIRECT) {




More information about the asterisk-commits mailing list