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
This commit is contained in:
Giovanni Maruzzelli 2009-07-29 11:07:46 +00:00
parent 506d3768a1
commit e929cd96a0
1 changed files with 7 additions and 2 deletions

View File

@ -348,9 +348,14 @@ static switch_status_t remove_interface(char *interface)
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread); globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
} }
memset(&globals.SKYPIAX_INTERFACES[interface_id], '\0', sizeof(private_t));
switch_mutex_lock(globals.mutex); 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--; globals.real_interfaces--;
switch_mutex_unlock(globals.mutex); switch_mutex_unlock(globals.mutex);