[asterisk-commits] tilghman: branch 1.6.0 r224857 - in /branches/1.6.0: ./ main/audiohook.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 20 17:10:57 CDT 2009


Author: tilghman
Date: Tue Oct 20 17:10:54 2009
New Revision: 224857

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=224857
Log:
Merged revisions 224856 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r224856 | tilghman | 2009-10-20 17:09:07 -0500 (Tue, 20 Oct 2009) | 12 lines
  
  Merged revisions 224855 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r224855 | tilghman | 2009-10-20 17:07:11 -0500 (Tue, 20 Oct 2009) | 5 lines
    
    Pay attention to the return value of the manipulate function.
    While this looks like an optimization, it prevents a crash from occurring
    when used with certain audiohook callbacks (diagnosed with SVN trunk,
    backported to 1.4 to keep the source consistent across versions).
  ........
................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/main/audiohook.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/main/audiohook.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/main/audiohook.c?view=diff&rev=224857&r1=224856&r2=224857
==============================================================================
--- branches/1.6.0/main/audiohook.c (original)
+++ branches/1.6.0/main/audiohook.c Tue Oct 20 17:10:54 2009
@@ -574,7 +574,7 @@
 	struct ast_frame *start_frame = frame, *middle_frame = frame, *end_frame = frame;
 	struct ast_audiohook *audiohook = NULL;
 	int samples = frame->samples;
-	
+
 	/* If the frame coming in is not signed linear we have to send it through the in_translate path */
 	if (frame->subclass != AST_FORMAT_SLINEAR) {
 		if (in_translate->format != frame->subclass) {
@@ -645,11 +645,16 @@
 				continue;
 			}
 			/* Feed in frame to manipulation */
-			audiohook->manipulate_callback(audiohook, chan, middle_frame, direction);
+			if (audiohook->manipulate_callback(audiohook, chan, middle_frame, direction)) {
+				ast_frfree(middle_frame);
+				middle_frame = NULL;
+			}
 			ast_audiohook_unlock(audiohook);
 		}
 		AST_LIST_TRAVERSE_SAFE_END
-		end_frame = middle_frame;
+		if (middle_frame) {
+			end_frame = middle_frame;
+		}
 	}
 
 	/* Now we figure out what to do with our end frame (whether to transcode or not) */
@@ -677,7 +682,9 @@
 		}
 	} else {
 		/* No frame was modified, we can just drop our middle frame and pass the frame we got in out */
-		ast_frfree(middle_frame);
+		if (middle_frame) {
+			ast_frfree(middle_frame);
+		}
 	}
 
 	return end_frame;




More information about the asterisk-commits mailing list