summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-04-15 16:38:35 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-04-15 16:38:35 +0000
commitc6a2a513c22f226f17def26b5283eaad8e367c15 (patch)
tree8cc4a4801590eb298e808dc7819b8cc0e97c9fa8 /channels
parentcc4a0a7fc9f2154e47f871650a2ec52c8c5bafc6 (diff)
chan_sip.c: Moved some sip_pvt unrefs after their last use.
* Moved sip_pvt unref in ast_hangup() and handle_request_do() to the end of the function. The unref needs to happen after the last use of the pointer. ........ Merged revisions 412348 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 412383 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index cf71ac453..ef57015dc 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7154,10 +7154,11 @@ static int sip_hangup(struct ast_channel *ast)
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER); /* Really hang up next time */
if (p->owner) {
- ast_channel_tech_pvt_set(p->owner, dialog_unref(ast_channel_tech_pvt(p->owner), "unref p->owner->tech_pvt"));
sip_pvt_lock(p);
+ oldowner = p->owner;
sip_set_owner(p, NULL); /* Owner will be gone after we return, so take it away */
sip_pvt_unlock(p);
+ ast_channel_tech_pvt_set(oldowner, dialog_unref(ast_channel_tech_pvt(oldowner), "unref oldowner->tech_pvt"));
}
ast_module_unref(ast_module_info->self);
return 0;
@@ -7193,7 +7194,7 @@ static int sip_hangup(struct ast_channel *ast)
disable_dsp_detect(p);
sip_set_owner(p, NULL);
- ast_channel_tech_pvt_set(ast, dialog_unref(ast_channel_tech_pvt(ast), "unref ast->tech_pvt"));
+ ast_channel_tech_pvt_set(ast, NULL);
ast_module_unref(ast_module_info->self);
/* Do not destroy this pvt until we have timeout or
@@ -7331,6 +7332,7 @@ static int sip_hangup(struct ast_channel *ast)
pvt_set_needdestroy(p, "hangup");
}
sip_pvt_unlock(p);
+ dialog_unref(p, "unref ast->tech_pvt");
return 0;
}
@@ -28259,12 +28261,12 @@ static int handle_request_do(struct sip_request *req, struct ast_sockaddr *addr)
ast_channel_unref(owner_chan_ref);
}
sip_pvt_unlock(p);
- ao2_t_ref(p, -1, "throw away dialog ptr from find_call at end of routine"); /* p is gone after the return */
ast_mutex_unlock(&netlock);
if (p->logger_callid) {
ast_callid_threadassoc_remove();
}
+ ao2_t_ref(p, -1, "throw away dialog ptr from find_call at end of routine"); /* p is gone after the return */
return 1;
}