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/branches/1.4@45104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Joshua Colp 19 years ago
parent dc04209898
commit 8c09239585

@ -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;
}

Loading…
Cancel
Save