aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-31 14:06:39 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-31 14:06:39 +0000
commitf3c4d543e8bd4b70d368d342e99a891a7bf3b644 (patch)
treec0a830a6aa0d21a0879040aab68248adb3ff9a71 /main
parent2f5faab89e889d8e69166acdbf78d2ce3945fdf1 (diff)
Fix crash when moving audiohooks between channels.
Handle the scenario where we are called to move audiohooks between channels and the source channel does not actually have any on it. (closes issue #14734) Reported by: corruptor git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@185196 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/audiohook.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main/audiohook.c b/main/audiohook.c
index cd5b7ca8a..fdd241db2 100644
--- a/main/audiohook.c
+++ b/main/audiohook.c
@@ -453,12 +453,12 @@ static struct ast_audiohook *find_audiohook_by_source(struct ast_audiohook_list
void ast_audiohook_move_by_source (struct ast_channel *old_chan, struct ast_channel *new_chan, const char *source)
{
- struct ast_audiohook *audiohook = find_audiohook_by_source(old_chan->audiohooks, source);
+ struct ast_audiohook *audiohook;
- if (!audiohook) {
+ if (!old_chan->audiohooks || !(audiohook = find_audiohook_by_source(old_chan->audiohooks, source))) {
return;
}
-
+
/* By locking both channels and the audiohook, we can assure that
* another thread will not have a chance to read the audiohook's status
* as done, even though ast_audiohook_remove signals the trigger