via: 4f5ca9e88dc1a94efa78878ca576d62345203ca2 (commit)
from: 06988e1a36d0f6f8b35651d36fdab79ac8c63c5c (commit)
= COMMIT LOG ===========================================================
committer: Christopher Rienzo
comments:
FS-3077 prevent crash on double call to asr_close
diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
index d5bac5f..8698e4a 100644
--- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
+++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
@@ -3155,15 +3155,19 @@ 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;
- speech_channel_stop(schannel);
- speech_channel_destroy(schannel);
- switch_core_hash_destroy(&r->grammars);
- switch_core_hash_destroy(&r->enabled_grammars);
- if (r->dtmf_generator) {
- mpf_dtmf_generator_destroy(r->dtmf_generator);
- }
+ 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);
+ switch_core_hash_destroy(&r->enabled_grammars);
+ 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);
Summary of changes: src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630
--
FreeSWITCH Source