]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8147: [mod_erlang_event] Fix process spawing segfault
authorTamas Cseke <tamas.cseke@virtual-call-center.eu>
Thu, 10 Sep 2015 09:23:58 +0000 (11:23 +0200)
committerMichael Jerris <mike@jerris.com>
Tue, 15 Sep 2015 16:23:10 +0000 (12:23 -0400)
Don't delete spawn reply because it can cause segfault in strncmp, check the flag instead

src/mod/event_handlers/mod_erlang_event/handle_msg.c
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

index 8461579a60cae3a8c20dcb34d5a2e28ef69a1e2d..ca472efa66ecb0a124c05eebdb07caa02dc6e4a2 100644 (file)
@@ -1224,7 +1224,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg,
        for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
                switch_core_hash_this(iter, &key, NULL, &val);
                se = (session_elem_t*)val;
-               if (se->spawn_reply && !strncmp(se->spawn_reply->hash, hash, 100)) {
+               if (switch_test_flag(se, LFLAG_WAITING_FOR_PID) && se->spawn_reply && !strncmp(se->spawn_reply->hash, hash, 100)) {
                        
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "found matching session for %s : %s\n", hash, se->uuid_str);
 
index 28575f0b8e995cbf5697c0b7ab7a7f77cb026aee..d9b73a4e8c635d8c8d2e0e98b4a2379fd0d0a46f 100644 (file)
@@ -1583,7 +1583,6 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul
 
        session_element->process.type = ERLANG_PID;
        memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid));
-       session_element->spawn_reply = NULL;
 
        switch_clear_flag_locked(session_element, LFLAG_WAITING_FOR_PID);