[asterisk-commits] rmudgett: branch 10 r377741 - in /branches/10: ./ main/indications.c

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


Author: rmudgett
Date: Mon Dec 10 20:11:29 2012
New Revision: 377741

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377741
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
........

Merged revisions 377740 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/main/indications.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/main/indications.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/indications.c?view=diff&rev=377741&r1=377740&r2=377741
==============================================================================
--- branches/10/main/indications.c (original)
+++ branches/10/main/indications.c Mon Dec 10 20:11:29 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);
 
@@ -939,7 +939,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);
 
@@ -1153,6 +1152,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;
@@ -1168,6 +1172,7 @@
 	}
 
 	if (load_indications(0)) {
+		indications_shutdown();
 		return -1;
 	}
 




More information about the asterisk-commits mailing list