diff options
author | David Vossel <dvossel@digium.com> | 2010-04-12 14:47:16 +0000 |
---|---|---|
committer | David Vossel <dvossel@digium.com> | 2010-04-12 14:47:16 +0000 |
commit | bd53cbabcf98c4e760e13691014fcedf1a738c4c (patch) | |
tree | cda3f0c55b9a0254b21d75b43366b176fe1ff986 /channels | |
parent | d2e1f421faee96562938547620aec0b2455cdea5 (diff) |
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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 21480b325..e8d9e4550 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -22680,10 +22680,12 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so 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); } } |