From 40968748631500059c39a668f682723e77ee74e3 Mon Sep 17 00:00:00 2001 From: file Date: Tue, 31 Mar 2009 14:07:36 +0000 Subject: Merged revisions 185196 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r185196 | file | 2009-03-31 11:06:39 -0300 (Tue, 31 Mar 2009) | 8 lines 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/trunk@185197 f38db490-d61c-443f-a65b-d21fe96a405b --- main/audiohook.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main/audiohook.c') diff --git a/main/audiohook.c b/main/audiohook.c index 8156d0ff3..640ec2f5a 100644 --- a/main/audiohook.c +++ b/main/audiohook.c @@ -441,12 +441,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 -- cgit v1.2.3