[asterisk-addons-commits] mnicholson: branch mnicholson/chan-mobile-refactor r782 - /team/mnicholson/ch...

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Thu Feb 19 10:26:07 CST 2009


Author: mnicholson
Date: Thu Feb 19 10:26:06 2009
New Revision: 782

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=782
Log:
fix error reporting and cleanup during module loading

Modified:
    team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c

Modified: team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c?view=diff&rev=782&r1=781&r2=782
==============================================================================
--- team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c (original)
+++ team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c Thu Feb 19 10:26:06 2009
@@ -3222,20 +3222,27 @@
 	/* Spin the discovery thread */
 	if (ast_pthread_create_background(&discovery_thread, NULL, do_discovery, NULL) < 0) {
 		ast_log(LOG_ERROR, "Unable to create discovery thread.\n");
-		return AST_MODULE_LOAD_DECLINE;
+		goto e_sdp_close;
+	}
+
+	/* Make sure we can register our channel type */
+	if (ast_channel_register(&mbl_tech)) {
+		ast_log(LOG_ERROR, "Unable to register channel class %s\n", "Mobile");
+		goto e_sdp_close;
 	}
 
 	ast_cli_register_multiple(mbl_cli, sizeof(mbl_cli) / sizeof(mbl_cli[0]));
 	ast_register_application(app_mblstatus, mbl_status_exec, mblstatus_synopsis, mblstatus_desc);
 	ast_register_application(app_mblsendsms, mbl_sendsms_exec, mblsendsms_synopsis, mblsendsms_desc);
 
-	/* Make sure we can register our channel type */
-	if (ast_channel_register(&mbl_tech)) {
-		ast_log(LOG_ERROR, "Unable to register channel class %s\n", "Mobile");
-		return AST_MODULE_LOAD_FAILURE;
-	}
 
 	return 0;
+
+e_sdp_close:
+	if (sdp_session)
+		sdp_close(sdp_session);
+
+	return AST_MODULE_LOAD_FAILURE;
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Bluetooth Mobile Device Channel Driver",




More information about the asterisk-addons-commits mailing list