diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-12 17:44:04 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-12 17:44:04 +0000 |
commit | cbb22ba26a195239fe78a1a438e2c2234ac6f590 (patch) | |
tree | 7bd48c0b85804e18ac0ea12e0cf4aae344678f5a | |
parent | 1f7450806b0574cad2d7ef20abe86356906a5e7a (diff) |
Merged revisions 89184 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r89184 | tilghman | 2007-11-12 11:29:17 -0600 (Mon, 12 Nov 2007) | 5 lines
Fix two cases of memory corruption caused by background threads.
Reported by: atis
Patch by: tilghman
Fixes issue #10923
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89185 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_sip.c | 10 | ||||
-rw-r--r-- | main/channel.c | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 45adf9103..1ac12a31f 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2423,10 +2423,18 @@ static int __sip_autodestruct(const void *data) transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, TRUE); /* Send last notification */ p->subscribed = NONE; append_history(p, "Subscribestatus", "timeout"); - ast_debug(3, "Re-scheduled destruction of SIP subsription %s\n", p->callid ? p->callid : "<unknown>"); + ast_debug(3, "Re-scheduled destruction of SIP subscription %s\n", p->callid ? p->callid : "<unknown>"); return 10000; /* Reschedule this destruction so that we know that it's gone */ } + /* If there are packets still waiting for delivery, delay the destruction */ + if (p->packets) { + if (option_debug > 2) + ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP call %s\n", p->callid ? p->callid : "<unknown>"); + append_history(p, "ReliableXmit", "timeout"); + return 10000; + } + if (p->subscribed == MWI_NOTIFICATION) if (p->relatedpeer) unref_peer(p->relatedpeer); /* Remove link to peer. If it's realtime, make sure it's gone from memory) */ diff --git a/main/channel.c b/main/channel.c index a0769fa0e..288d759f2 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1418,6 +1418,8 @@ int ast_hangup(struct ast_channel *chan) chan->audiohooks = NULL; } + ast_autoservice_stop(chan); + if (chan->masq) { if (ast_do_masquerade(chan)) ast_log(LOG_WARNING, "Failed to perform masquerade\n"); |