[Freeswitch-svn] [commit] r8471 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Mon May 19 15:24:20 EDT 2008


Author: mikej
Date: Mon May 19 15:24:20 2008
New Revision: 8471

Modified:
   freeswitch/trunk/src/switch_ivr_originate.c

Log:
don't leak on switch_ivr_wait_for_answer when peer channel is already answered or pre-answered. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Mon May 19 15:24:20 2008
@@ -268,6 +268,10 @@
 	const char *var = switch_channel_get_variable(caller_channel, "call_timeout");
 	switch_time_t start = 0;
 	
+	if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
 	switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
@@ -281,10 +285,6 @@
 	timelimit *= 1000000;
 	start = switch_timestamp_now();
 
-	if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-		return SWITCH_STATUS_SUCCESS;
-	}
-
 	if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
 		ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
 	} 



More information about the Freeswitch-svn mailing list