mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-09 09:17:34 +00:00
FS-3077 prevent crash on double call to asr_close
This commit is contained in:
parent
06988e1a36
commit
4f5ca9e88d
@ -3155,7 +3155,11 @@ static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah)
|
||||
static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
|
||||
{
|
||||
speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
|
||||
recognizer_data_t *r = (recognizer_data_t *) schannel->data;
|
||||
recognizer_data_t *r = NULL;
|
||||
|
||||
/* close if not already closed */
|
||||
if (schannel != NULL && !switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||
r = (recognizer_data_t *) schannel->data;
|
||||
speech_channel_stop(schannel);
|
||||
speech_channel_destroy(schannel);
|
||||
switch_core_hash_destroy(&r->grammars);
|
||||
@ -3163,7 +3167,7 @@ static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_
|
||||
if (r->dtmf_generator) {
|
||||
mpf_dtmf_generator_destroy(r->dtmf_generator);
|
||||
}
|
||||
|
||||
}
|
||||
/* this lets FreeSWITCH's speech_thread know the handle is closed */
|
||||
switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user