Author: anthm Date: Fri Jun 6 11:27:16 2008 New Revision: 8779 Modified: freeswitch/trunk/src/include/switch_cpp.h freeswitch/trunk/src/switch_cpp.cpp Log: fix FSCORE-136 Modified: freeswitch/trunk/src/include/switch_cpp.h ============================================================================== --- freeswitch/trunk/src/include/switch_cpp.h (original) +++ freeswitch/trunk/src/include/switch_cpp.h Fri Jun 6 11:27:16 2008 @@ -13,7 +13,7 @@ #define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0) #define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0) #define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0) -#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0) +#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&caller_profile, 0, sizeof(caller_profile)); memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0) //// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution// #if 0 #ifndef SWITCHTOMEMPOOL Modified: freeswitch/trunk/src/switch_cpp.cpp ============================================================================== --- freeswitch/trunk/src/switch_cpp.cpp (original) +++ freeswitch/trunk/src/switch_cpp.cpp Fri Jun 6 11:27:16 2008 @@ -402,7 +402,15 @@ { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::~CoreSession desctructor\n"); switch_channel_t *channel = NULL; - + + init_vars(); + this_check_void(); + + switch_safe_free(xml_cdr_text); + switch_safe_free(uuid); + switch_safe_free(tts_name); + switch_safe_free(voice_name); + if (session) { channel = switch_core_session_get_channel(session); if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) { @@ -411,10 +419,7 @@ switch_core_session_rwunlock(session); } - switch_safe_free(xml_cdr_text); - switch_safe_free(uuid); - switch_safe_free(tts_name); - switch_safe_free(voice_name); + } SWITCH_DECLARE(char *) CoreSession::getXMLCDR() @@ -783,7 +788,6 @@ switch_call_cause_t cause; this_check(0); - sanity_check(0); cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;