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

FreeSWITCH SVN mrene at freeswitch.org
Wed Apr 22 22:26:21 PDT 2009


Author: mrene
Date: Thu Apr 23 00:26:21 2009
New Revision: 13130

Log:
Fix missing UNPROTECT_INTERFACE in case pre_answer fails

Modified:
   freeswitch/trunk/src/switch_core_session.c

Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c	(original)
+++ freeswitch/trunk/src/switch_core_session.c	Thu Apr 23 00:26:21 2009
@@ -1296,7 +1296,8 @@
 SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(switch_core_session_t *session, const char *app, const char *arg)
 {
 	switch_application_interface_t *application_interface;
-
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	
 	if (switch_channel_down(session->channel)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is hungup, aborting execution of application: %s\n", app);
 		return SWITCH_STATUS_FALSE;
@@ -1311,8 +1312,7 @@
 	if (!application_interface->application_function) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", app);
 		switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		UNPROTECT_INTERFACE(application_interface);
-		return SWITCH_STATUS_FALSE;
+		switch_goto_status(SWITCH_STATUS_FALSE, done);
 	}
 
 	if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
@@ -1324,15 +1324,16 @@
 						  app, switch_channel_get_name(session->channel));
 		if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Well, that didn't work very well did it? ...\n");
-			return SWITCH_STATUS_FALSE;
+			switch_goto_status(SWITCH_STATUS_FALSE, done);
 		}
 	}
 
 	switch_core_session_exec(session, application_interface, arg);
 
+done:
 	UNPROTECT_INTERFACE(application_interface);
 	
-	return SWITCH_STATUS_SUCCESS;
+	return status;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,



More information about the Freeswitch-svn mailing list