mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-23 03:33:48 +00:00
fix crash when passing null string to switch_core_session_locate (via killchan with no param)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2479 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
0da13b72f2
commit
657ca535ed
src
@ -117,7 +117,7 @@ static switch_status_t kill_function(char *dest, switch_core_session_t *isession
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((session = switch_core_session_locate(dest))) {
|
if (dest && (session = switch_core_session_locate(dest))) {
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_core_session_kill_channel(session, SWITCH_SIG_KILL);
|
switch_core_session_kill_channel(session, SWITCH_SIG_KILL);
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||||
|
@ -269,18 +269,22 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(char *uuid_st
|
|||||||
{
|
{
|
||||||
switch_core_session_t *session;
|
switch_core_session_t *session;
|
||||||
|
|
||||||
switch_mutex_lock(runtime.session_table_mutex);
|
if (uuid_str) {
|
||||||
if ((session = switch_core_hash_find(runtime.session_table, uuid_str))) {
|
switch_mutex_lock(runtime.session_table_mutex);
|
||||||
/* Acquire a read lock on the session */
|
if ((session = switch_core_hash_find(runtime.session_table, uuid_str))) {
|
||||||
if (switch_thread_rwlock_tryrdlock(session->rwlock) != SWITCH_STATUS_SUCCESS) {
|
/* Acquire a read lock on the session */
|
||||||
/* not available, forget it */
|
if (switch_thread_rwlock_tryrdlock(session->rwlock) != SWITCH_STATUS_SUCCESS) {
|
||||||
session = NULL;
|
/* not available, forget it */
|
||||||
|
session = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
switch_mutex_unlock(runtime.session_table_mutex);
|
||||||
switch_mutex_unlock(runtime.session_table_mutex);
|
|
||||||
|
|
||||||
/* if its not NULL, now it's up to you to rwunlock this */
|
/* if its not NULL, now it's up to you to rwunlock this */
|
||||||
return session;
|
return session;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_core_session_hupall(void)
|
SWITCH_DECLARE(void) switch_core_session_hupall(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user