aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-02-19 20:07:01 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-02-19 20:07:01 +0000
commitde0053614d5f9734bf9a6248c83327882a4d4d7b (patch)
tree2cf1ee61d56cf6a047873f4ba8ff930b826c4460 /channel.c
parent4fe3f37b3e961d807367296dc1a62c43eb0d5adc (diff)
Don't free clone lock until after *both* fixups have taken place
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2199 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/channel.c b/channel.c
index 0de79cdf2..ef966d21b 100755
--- a/channel.c
+++ b/channel.c
@@ -2089,19 +2089,6 @@ static int ast_do_masquerade(struct ast_channel *original)
/* Context, extension, priority, app data, jump table, remain the same */
/* pvt switches. pbx stays the same, as does next */
- /* Now, at this point, the "clone" channel is totally F'd up. We mark it as
- a zombie so nothing tries to touch it. If it's already been marked as a
- zombie, then free it now (since it already is considered invalid). */
- if (clone->zombie) {
- ast_log(LOG_DEBUG, "Destroying clone '%s'\n", clone->name);
- ast_mutex_unlock(&clone->lock);
- ast_channel_free(clone);
- manager_event(EVENT_FLAG_CALL, "Hangup", "Channel: %s\r\n", zombn);
- } else {
- ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
- clone->zombie=1;
- ast_mutex_unlock(&clone->lock);
- }
/* Set the write format */
ast_set_write_format(original, wformat);
@@ -2122,6 +2109,21 @@ static int ast_do_masquerade(struct ast_channel *original)
} else
ast_log(LOG_WARNING, "Driver '%s' does not have a fixup routine (for %s)! Bad things may happen.\n",
original->type, original->name);
+
+ /* Now, at this point, the "clone" channel is totally F'd up. We mark it as
+ a zombie so nothing tries to touch it. If it's already been marked as a
+ zombie, then free it now (since it already is considered invalid). */
+ if (clone->zombie) {
+ ast_log(LOG_DEBUG, "Destroying clone '%s'\n", clone->name);
+ ast_mutex_unlock(&clone->lock);
+ ast_channel_free(clone);
+ manager_event(EVENT_FLAG_CALL, "Hangup", "Channel: %s\r\n", zombn);
+ } else {
+ ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
+ clone->zombie=1;
+ ast_mutex_unlock(&clone->lock);
+ }
+
/* Signal any blocker */
if (original->blocking)
pthread_kill(original->blocker, SIGURG);