From: Anthony Minessale Date: Mon, 14 Apr 2014 20:57:28 +0000 (+0500) Subject: stable branch version of spandsp changes in 4178688b4a7c77cc5ca296fd6bc0b91fea0d0f2a X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a18ae09c6153f3ed2b706c90d19ac1346aaef328;p=thirdparty%2Ffreeswitch.git stable branch version of spandsp changes in 4178688b4a7c77cc5ca296fd6bc0b91fea0d0f2a --- diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 08bcf5e17d..5789918292 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -477,6 +477,25 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel CONFIGURATION ************************************************************************* */ +static void destroy_tones(void) +{ + if (spandsp_globals.tones) { + switch_hash_index_t *hi; + void *val; + const void *vvar; + tone_descriptor_t *d; + + for (hi = switch_hash_first(NULL, spandsp_globals.tones); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &vvar, NULL, &val); + + d = (tone_descriptor_t *) val; + super_tone_rx_free_descriptor(d->spandsp_tone_descriptor); + } + + switch_core_hash_destroy(&spandsp_globals.tones); + } +} + switch_status_t load_configuration(switch_bool_t reload) { switch_xml_t xml = NULL, x_lists = NULL, x_list = NULL, cfg = NULL, callprogress = NULL, xdescriptor = NULL; @@ -484,10 +503,6 @@ switch_status_t load_configuration(switch_bool_t reload) switch_mutex_lock(spandsp_globals.mutex); - if (spandsp_globals.tones) { - switch_core_hash_destroy(&spandsp_globals.tones); - } - if (spandsp_globals.config_pool) { switch_core_destroy_memory_pool(&spandsp_globals.config_pool); } @@ -819,9 +834,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown) mod_spandsp_dsp_shutdown(); modem_global_shutdown(); - if (spandsp_globals.tones) { - switch_core_hash_destroy(&spandsp_globals.tones); - } + destroy_tones(); + if (spandsp_globals.config_pool) { switch_core_destroy_memory_pool(&spandsp_globals.config_pool);