[asterisk-commits] rmudgett: branch 1.8 r377740 - /branches/1.8/main/indications.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 10 20:09:36 CST 2012


Author: rmudgett
Date: Mon Dec 10 20:09:33 2012
New Revision: 377740

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377740
Log:
Cleanup indications on exit.

* Made ast_unregister_indication_country() unlink the found tone zone
before selecting a new default_tone_zone to make it impossible to select
the tone zone being unregistered again.

* Ringcadence is no longer parsed twice in store_config_tone_zone().

* Cleanup CLI commands and destroy default_tone_zone on exit.

(issue ASTERISK-20649)
Reported by: Corey Farrell
Patches:
      indications-cleanup-all.patch (license #5909) patch uploaded by Corey Farrell
      Modified

Modified:
    branches/1.8/main/indications.c

Modified: branches/1.8/main/indications.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/indications.c?view=diff&rev=377740&r1=377739&r2=377740
==============================================================================
--- branches/1.8/main/indications.c (original)
+++ branches/1.8/main/indications.c Mon Dec 10 20:09:33 2012
@@ -560,19 +560,19 @@
 
 	ast_copy_string(zone_arg.country, country, sizeof(zone_arg.country));
 
-	if (!(tz = ao2_find(ast_tone_zones, &zone_arg, OBJ_POINTER))) {
-		return -1;
-	}
-
 	ao2_lock(ast_tone_zones);
+	tz = ao2_find(ast_tone_zones, &zone_arg, OBJ_POINTER | OBJ_UNLINK);
+	if (!tz) {
+		ao2_unlock(ast_tone_zones);
+		return -1;
+	}
+
 	if (default_tone_zone == tz) {
 		ast_tone_zone_unref(default_tone_zone);
 		/* Get a new default, punt to the first one we find */
 		default_tone_zone = ao2_callback(ast_tone_zones, 0, NULL, NULL);
 	}
 	ao2_unlock(ast_tone_zones);
-
-	ao2_unlink(ast_tone_zones, tz);
 
 	tz = ast_tone_zone_unref(tz);
 
@@ -938,7 +938,6 @@
 
 	CV_STR("description", zone->description);
 	CV_F("ringcadence", store_tone_zone_ring_cadence(zone, value));
-	CV_F("ringcadance", store_tone_zone_ring_cadence(zone, value));
 
 	ast_register_indication(zone, var, value);
 
@@ -1152,6 +1151,11 @@
 /*! \internal \brief Clean up resources on Asterisk shutdown */
 static void indications_shutdown(void)
 {
+	ast_cli_unregister_multiple(cli_indications, ARRAY_LEN(cli_indications));
+	if (default_tone_zone) {
+		ast_tone_zone_unref(default_tone_zone);
+		default_tone_zone = NULL;
+	}
 	if (ast_tone_zones) {
 		ao2_ref(ast_tone_zones, -1);
 		ast_tone_zones = NULL;
@@ -1167,6 +1171,7 @@
 	}
 
 	if (load_indications(0)) {
+		indications_shutdown();
 		return -1;
 	}
 




More information about the asterisk-commits mailing list