[asterisk-commits] dvossel: trunk r256823 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 12 09:47:18 CDT 2010


Author: dvossel
Date: Mon Apr 12 09:47:16 2010
New Revision: 256823

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=256823
Log:
gives channel reference before unlocking it and using setvar helper.

To guarantee the channel is valid when calling setvar on the MASTER_CHANNEL
dialplan function, a channel reference must be taken before unlocking. Thanks
to russell for pointing out the error.


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=256823&r1=256822&r2=256823
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Apr 12 09:47:16 2010
@@ -22680,10 +22680,12 @@
 				snprintf(causevar, sizeof(causevar), "MASTER_CHANNEL(HASH(SIP_CAUSE,%s))", owner->name);
 				snprintf(causeval, sizeof(causeval), "SIP %s", REQ_OFFSET_TO_STR(req, rlPart2));
 
+				ast_channel_ref(owner);
 				sip_pvt_unlock(p);
 				ast_channel_unlock(owner);
 				*nounlock = 1;
 				pbx_builtin_setvar_helper(owner, causevar, causeval);
+				ast_channel_unref(owner);
 				sip_pvt_lock(p);
 			}
 		}




More information about the asterisk-commits mailing list