mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
FS-10118: [freeswitch-core] Race conditions from lack of error checking in switch_core_session_read_lock #resolve
This commit is contained in:
@@ -3271,14 +3271,22 @@ struct camping_stake {
|
||||
static void *SWITCH_THREAD_FUNC camp_music_thread(switch_thread_t *thread, void *obj)
|
||||
{
|
||||
struct camping_stake *stake = (struct camping_stake *) obj;
|
||||
switch_core_session_t *session = stake->session;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(stake->session);
|
||||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
const char *moh = stake->moh, *greet = NULL;
|
||||
switch_input_args_t args = { 0 };
|
||||
char dbuf[2] = "";
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
const char *stop;
|
||||
|
||||
session = stake->session;
|
||||
|
||||
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
channel = switch_core_session_get_channel(stake->session);
|
||||
|
||||
if ((stop = switch_channel_get_variable(channel, "campon_stop_key"))) {
|
||||
*dbuf = *stop;
|
||||
}
|
||||
@@ -3287,8 +3295,6 @@ static void *SWITCH_THREAD_FUNC camp_music_thread(switch_thread_t *thread, void
|
||||
args.buf = dbuf;
|
||||
args.buflen = sizeof(dbuf);
|
||||
|
||||
switch_core_session_read_lock(session);
|
||||
|
||||
/* don't set this to a local_stream:// or you will not be happy */
|
||||
if ((greet = switch_channel_get_variable(channel, "campon_announce_sound"))) {
|
||||
status = switch_ivr_play_file(session, NULL, greet, &args);
|
||||
|
Reference in New Issue
Block a user