From e929cd96a046d4a6e4427afc4219b1ed065f462c Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 29 Jul 2009 11:07:46 +0000 Subject: [PATCH] skypiax: fixed crash when you set an interface as 'sk' console, then remove the interface, then use the 'sk' command to send a message to the API (it try to use a non-existing interface) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14411 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_skypiax/mod_skypiax.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skypiax/mod_skypiax.c b/src/mod/endpoints/mod_skypiax/mod_skypiax.c index 969b2a717b..6731bc35ce 100644 --- a/src/mod/endpoints/mod_skypiax/mod_skypiax.c +++ b/src/mod/endpoints/mod_skypiax/mod_skypiax.c @@ -348,9 +348,14 @@ static switch_status_t remove_interface(char *interface) globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread); } - memset(&globals.SKYPIAX_INTERFACES[interface_id], '\0', sizeof(private_t)); - switch_mutex_lock(globals.mutex); + if(globals.sk_console == &globals.SKYPIAX_INTERFACES[interface_id]){ + DEBUGA_SKYPE("interface '%s' no more console\n", SKYPIAX_P_LOG, interface); + globals.sk_console = NULL; + } else { + DEBUGA_SKYPE("interface '%s' STILL console\n", SKYPIAX_P_LOG, interface); + } + memset(&globals.SKYPIAX_INTERFACES[interface_id], '\0', sizeof(private_t)); globals.real_interfaces--; switch_mutex_unlock(globals.mutex);