[asterisk-commits] kmoore: branch kmoore/parking_unload r396813 - /team/kmoore/parking_unload/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 15 16:56:47 CDT 2013


Author: kmoore
Date: Thu Aug 15 16:56:45 2013
New Revision: 396813

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396813
Log:
Clean up partial failed loads

Modified:
    team/kmoore/parking_unload/res/res_parking.c

Modified: team/kmoore/parking_unload/res/res_parking.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/parking_unload/res/res_parking.c?view=diff&rev=396813&r1=396812&r2=396813
==============================================================================
--- team/kmoore/parking_unload/res/res_parking.c (original)
+++ team/kmoore/parking_unload/res/res_parking.c Thu Aug 15 16:56:45 2013
@@ -1162,6 +1162,22 @@
 	ast_module_unref(ast_module_info->self);
 }
 
+static int unload_module(void)
+{
+	unload_parking_bridge_features();
+	remove_all_configured_parking_lot_extensions();
+	unload_parking_applications();
+	unload_parking_manager();
+	unload_parking_ui();
+	unload_parking_devstate();
+	unload_parking_tests();
+	ao2_cleanup(parking_lot_container);
+	parking_lot_container = NULL;
+	aco_info_destroy(&cfg_info);
+
+	return 0;
+}
+
 static int load_module(void)
 {
 	parking_lot_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX,
@@ -1231,9 +1247,7 @@
 	return AST_MODULE_LOAD_SUCCESS;
 
 error:
-	/* XXX errored loads don't currently do a good job of cleaning up after themselves */
-	ao2_cleanup(parking_lot_container);
-	aco_info_destroy(&cfg_info);
+	unload_module();
 	return AST_MODULE_LOAD_DECLINE;
 }
 
@@ -1242,22 +1256,6 @@
 	if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
-
-	return 0;
-}
-
-static int unload_module(void)
-{
-	unload_parking_bridge_features();
-	remove_all_configured_parking_lot_extensions();
-	unload_parking_applications();
-	unload_parking_manager();
-	unload_parking_ui();
-	unload_parking_devstate();
-	unload_parking_tests();
-	ao2_cleanup(parking_lot_container);
-	parking_lot_container = NULL;
-	aco_info_destroy(&cfg_info);
 
 	return 0;
 }




More information about the asterisk-commits mailing list