Index: main/indications.c =================================================================== --- main/indications.c (revision 375799) +++ main/indications.c (working copy) @@ -565,6 +565,8 @@ } ao2_lock(ast_tone_zones); + ao2_unlink(ast_tone_zones, tz); + if (default_tone_zone == tz) { ast_tone_zone_unref(default_tone_zone); /* Get a new default, punt to the first one we find */ @@ -572,8 +574,6 @@ } ao2_unlock(ast_tone_zones); - ao2_unlink(ast_tone_zones, tz); - tz = ast_tone_zone_unref(tz); return 0; @@ -626,6 +626,7 @@ if (!strcasecmp(indication, ts->name)) { AST_LIST_REMOVE_CURRENT(entry); ts = ast_tone_zone_sound_unref(ts); + ts = ast_tone_zone_sound_unref(ts); res = 0; break; } @@ -938,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); @@ -1152,7 +1152,16 @@ /*! \internal \brief Clean up resources on Asterisk shutdown */ static void indications_shutdown(void) { + ast_cli_unregister_multiple(cli_indications, ARRAY_LEN(cli_indications)); if (ast_tone_zones) { + struct ast_tone_zone *tz; + struct ao2_iterator it = ast_tone_zone_iterator_init(); + while ((tz = ao2_iterator_next(&it))) { + ast_unregister_indication_country(tz->country); + tz = ast_tone_zone_unref(tz); + } + ao2_iterator_destroy(&it); + ao2_ref(ast_tone_zones, -1); ast_tone_zones = NULL; }