diff options
author | Joshua Colp <jcolp@digium.com> | 2006-10-13 21:03:05 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2006-10-13 21:03:05 +0000 |
commit | fd2bd9a87ebc97f7f791cd45962d26074fa5e7cf (patch) | |
tree | a62a83bf61dc62fdf507c6295cb8bf7989d7ca63 | |
parent | edc6c54145e0c0c7601a4fed8493b9c8e7aed8f5 (diff) |
Merged revisions 45104 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r45104 | file | 2006-10-13 17:01:13 -0400 (Fri, 13 Oct 2006) | 2 lines
Check return value from engine in case of failure (ie: out of licenses) (reported on -dev mailing list)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-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; } |