diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-30 19:21:04 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-30 19:21:04 +0000 |
commit | 712c72b0df2fb7badefffb68c319f4a105ae9c71 (patch) | |
tree | 89d592fc9e276ed41a21062589ea44fedcf6d0d2 /apps/app_speech_utils.c | |
parent | 829d44846c2cbb8f568e5368c8e033daba211ae0 (diff) |
Lock around variables retrieved, and copy the values, if they stay persistent,
since another thread could remove them.
(closes issue #12541)
Reported by: snuffy
Patches:
bug_12156_apps.diff uploaded by snuffy (license 35)
Several additional changes by me
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114904 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_speech_utils.c')
-rw-r--r-- | apps/app_speech_utils.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index 6033923ee..4677c33b6 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -559,9 +559,11 @@ static int speech_background(struct ast_channel *chan, void *data) } /* See if the maximum DTMF length variable is set... we use a variable in case they want to carry it through their entire dialplan */ - if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2)) + ast_channel_lock(chan); + if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2)) { max_dtmf_len = atoi(tmp2); - + } + /* See if a terminator is specified */ if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_TERMINATOR"))) { if (ast_strlen_zero(tmp2)) @@ -569,6 +571,7 @@ static int speech_background(struct ast_channel *chan, void *data) else dtmf_terminator = tmp2[0]; } + ast_channel_unlock(chan); /* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */ if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) { |