]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Sun, 22 Mar 2009 21:32:08 +0000 (21:32 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sun, 22 Mar 2009 21:32:08 +0000 (21:32 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12718 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_lua/freeswitch_lua.cpp
src/switch_cpp.cpp

index 67984b756694d3c8639da207527073f72005fa69..a5c1cd8007facc12035e7a81f73f0a04164af238 100644 (file)
@@ -32,7 +32,7 @@ Session::~Session()
                if (session) {
                        switch_core_event_hook_remove_state_change(session, lua_hanguphook);
                }
-               free(hangup_func_str);
+               switch_safe_free(hangup_func_str);
        }
 
        switch_safe_free(hangup_func_arg);
@@ -128,6 +128,16 @@ void Session::do_hangup_hook()
                if (!switch_strlen_zero(err)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
                }
+
+               if (channel) {
+                       switch_channel_set_private(channel, "CoreSession", NULL);
+               }
+
+               if (session) {
+                       switch_core_event_hook_remove_state_change(session, lua_hanguphook);
+               }
+               switch_safe_free(hangup_func_str);
+
        }
 }
 
@@ -142,7 +152,10 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
                channel = switch_core_session_get_channel(session_hungup);
 
                if (channel) {
-                       coresession = (Session *) switch_channel_get_private(channel, "CoreSession");
+                       void *vs = switch_channel_get_private(channel, "CoreSession");
+                       if (vs) {
+                               coresession = (Session *) vs;
+                       }
                }
                
                if (!(coresession && coresession->hook_state)) {
index 6ea314a5cadfc51132902675a392e84d43de39d5..ebd13bf1911708c0ec067e08d66f66869743ca0a 100644 (file)
@@ -888,6 +888,10 @@ SWITCH_DECLARE(void) CoreSession::destroy(void)
 {
        this_check_void();
 
+       if (channel) {
+               switch_channel_set_private(channel, "CoreSession", NULL);
+       }
+       
        switch_safe_free(xml_cdr_text);
        switch_safe_free(uuid); 
        switch_safe_free(tts_name);