[asterisk-commits] russell: trunk r106238 - in /trunk: ./ channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 5 16:40:59 CST 2008
Author: russell
Date: Wed Mar 5 16:40:58 2008
New Revision: 106238
URL: http://svn.digium.com/view/asterisk?view=rev&rev=106238
Log:
Merged revisions 106237 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r106237 | russell | 2008-03-05 16:37:09 -0600 (Wed, 05 Mar 2008) | 3 lines
Fix a potential deadlock and a few different potential crashes.
(closes issue #12145, reported by thiagarcia, patched by me)
........
Modified:
trunk/ (props changed)
trunk/channels/chan_iax2.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=106238&r1=106237&r2=106238
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Mar 5 16:40:58 2008
@@ -7073,7 +7073,10 @@
/* Once we have this lock, we're sure nobody else is using it or could use it once we release it,
because by the time they could get tpeerlock, we've already grabbed it */
ast_debug(1, "Dropping unused iax2 trunk peer '%s:%d'\n", ast_inet_ntoa(drop->addr.sin_addr), ntohs(drop->addr.sin_port));
- ast_free(drop->trunkdata);
+ if (drop->trunkdata) {
+ ast_free(drop->trunkdata);
+ drop->trunkdata = NULL;
+ }
ast_mutex_unlock(&drop->lock);
ast_mutex_destroy(&drop->lock);
ast_free(drop);
@@ -8415,29 +8418,42 @@
iax2_destroy(fr->callno);
break;
case IAX_COMMAND_TRANSFER:
- if (iaxs[fr->callno]->owner && ast_bridged_channel(iaxs[fr->callno]->owner) && ies.called_number) {
+ {
+ struct ast_channel *bridged_chan;
+
+ if (iaxs[fr->callno]->owner && (bridged_chan = ast_bridged_channel(iaxs[fr->callno]->owner)) && ies.called_number) {
/* Set BLINDTRANSFER channel variables */
- pbx_builtin_setvar_helper(iaxs[fr->callno]->owner, "BLINDTRANSFER", ast_bridged_channel(iaxs[fr->callno]->owner)->name);
- pbx_builtin_setvar_helper(ast_bridged_channel(iaxs[fr->callno]->owner), "BLINDTRANSFER", iaxs[fr->callno]->owner->name);
+
+ ast_mutex_unlock(&iaxsl[fr->callno]);
+ pbx_builtin_setvar_helper(iaxs[fr->callno]->owner, "BLINDTRANSFER", bridged_chan->name);
+ ast_mutex_lock(&iaxsl[fr->callno]);
+ if (!iaxs[fr->callno]) {
+ ast_mutex_unlock(&iaxsl[fr->callno]);
+ return 1;
+ }
+
+ pbx_builtin_setvar_helper(bridged_chan, "BLINDTRANSFER", iaxs[fr->callno]->owner->name);
if (!strcmp(ies.called_number, ast_parking_ext())) {
- if (iax_park(ast_bridged_channel(iaxs[fr->callno]->owner), iaxs[fr->callno]->owner)) {
- ast_log(LOG_WARNING, "Failed to park call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name);
- } else if (ast_bridged_channel(iaxs[fr->callno]->owner)) {
+ if (iax_park(bridged_chan, iaxs[fr->callno]->owner)) {
+ ast_log(LOG_WARNING, "Failed to park call on '%s'\n", bridged_chan->name);
+ } else {
ast_debug(1, "Parked call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name);
}
} else {
- if (ast_async_goto(ast_bridged_channel(iaxs[fr->callno]->owner), iaxs[fr->callno]->context, ies.called_number, 1))
- ast_log(LOG_WARNING, "Async goto of '%s' to '%s@%s' failed\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name,
+ if (ast_async_goto(bridged_chan, iaxs[fr->callno]->context, ies.called_number, 1))
+ ast_log(LOG_WARNING, "Async goto of '%s' to '%s@%s' failed\n", bridged_chan->name,
ies.called_number, iaxs[fr->callno]->context);
else {
- ast_debug(1, "Async goto of '%s' to '%s@%s' started\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name,
+ ast_debug(1, "Async goto of '%s' to '%s@%s' started\n", bridged_chan->name,
ies.called_number, iaxs[fr->callno]->context);
}
}
} else {
ast_debug(1, "Async goto not applicable on call %d\n", fr->callno);
}
+
break;
+ }
case IAX_COMMAND_ACCEPT:
/* Ignore if call is already up or needs authentication or is a TBD */
if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED | IAX_STATE_TBD | IAX_STATE_AUTHENTICATED))
More information about the asterisk-commits
mailing list