[asterisk-commits] file: branch 1.4 r45104 - /branches/1.4/res/res_speech.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Oct 13 14:01:14 MST 2006


Author: file
Date: Fri Oct 13 16:01:13 2006
New Revision: 45104

URL: http://svn.digium.com/view/asterisk?rev=45104&view=rev
Log:
Check return value from engine in case of failure (ie: out of licenses) (reported on -dev mailing list)

Modified:
    branches/1.4/res/res_speech.c

Modified: branches/1.4/res/res_speech.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_speech.c?rev=45104&r1=45103&r2=45104&view=diff
==============================================================================
--- branches/1.4/res/res_speech.c (original)
+++ branches/1.4/res/res_speech.c Fri Oct 13 16:01:13 2006
@@ -235,8 +235,12 @@
 	/* 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;
 }



More information about the asterisk-commits mailing list