diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-13 21:01:13 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-13 21:01:13 +0000 |
commit | cdae1298356d0aad2055a971e9feb2ec2d9c4dfb (patch) | |
tree | 9f49e20bedc4919fc98ed70cbda9e7c40cf11ada /res/res_speech.c | |
parent | ba5defcffd4ad765ddaecbd448a7fc991579b29a (diff) |
Check return value from engine in case of failure (ie: out of licenses) (reported on -dev mailing list)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@45104 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_speech.c')
-rw-r--r-- | res/res_speech.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/res/res_speech.c b/res/res_speech.c index d0af877cd..8330333b7 100644 --- a/res/res_speech.c +++ b/res/res_speech.c @@ -235,8 +235,12 @@ struct ast_speech *ast_speech_new(char *engine_name, int format) /* We are not ready to accept audio yet */ ast_speech_change_state(new_speech, AST_SPEECH_STATE_NOT_READY); - /* Pass ourselves to the engine so they can set us up some more */ - engine->new(new_speech); + /* Pass ourselves to the engine so they can set us up some more and if they error out then do not create a structure */ + if (engine->new(new_speech)) { + ast_mutex_destroy(&new_speech->lock); + free(new_speech); + new_speech = NULL; + } return new_speech; } |