[asterisk-commits] file: branch 1.4 r185196 - /branches/1.4/main/audiohook.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 31 09:06:44 CDT 2009


Author: file
Date: Tue Mar 31 09:06:39 2009
New Revision: 185196

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185196
Log:
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

Modified:
    branches/1.4/main/audiohook.c

Modified: branches/1.4/main/audiohook.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/main/audiohook.c?view=diff&rev=185196&r1=185195&r2=185196
==============================================================================
--- branches/1.4/main/audiohook.c (original)
+++ branches/1.4/main/audiohook.c Tue Mar 31 09:06:39 2009
@@ -453,12 +453,12 @@
 
 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);
-
-	if (!audiohook) {
+	struct ast_audiohook *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




More information about the asterisk-commits mailing list