From e57ccc74b659520a2c7ae6a1a3dbf46ef4865cd7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 16 Jun 2009 17:39:03 +0000 Subject: [PATCH] declinatio mortuus obfirmo git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13784 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_core_asr.c | 9 ++++++++- src/switch_core_speech.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index 44bfba3338..4f851c6fd5 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -77,7 +77,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah, ah->rate = rate; ah->name = switch_core_strdup(ah->memory_pool, module_name); - return ah->asr_interface->asr_open(ah, codec, rate, dest, flags); + status = ah->asr_interface->asr_open(ah, codec, rate, dest, flags); + + if (status != SWITCH_STATUS_SUCCESS) { + UNPROTECT_INTERFACE(ah->asr_interface); + } + + return status; + } SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name) diff --git a/src/switch_core_speech.c b/src/switch_core_speech.c index 25a8459c6a..5e9be3871d 100644 --- a/src/switch_core_speech.c +++ b/src/switch_core_speech.c @@ -86,6 +86,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t * if ((status = sh->speech_interface->speech_open(sh, voice_name, rate, flags)) == SWITCH_STATUS_SUCCESS) { switch_set_flag(sh, SWITCH_SPEECH_FLAG_OPEN); + } else { + UNPROTECT_INTERFACE(sh->speech_interface); } return status;