mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-10 11:50:53 +00:00
add switch_hashtable_insert_destructor so you can insert a pointer into a hash with a custom destructor and use it in spandsp to fix a leak on reloadxml with the tone_descriptor tables and fix a bunch of random tiny leaks etc
This commit is contained in:
1 parent
d789c6470a
commit
4178688b4a
12 files changed
+56
-37
No files matched your search
@@ -476,6 +476,12 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel
|
||||
/* **************************************************************************
|
||||
CONFIGURATION
|
||||
************************************************************************* */
|
||||
static void destroy_descriptor(void *ptr)
|
||||
{
|
||||
tone_descriptor_t *d = (tone_descriptor_t *) ptr;
|
||||
|
||||
super_tone_rx_free_descriptor(d->spandsp_tone_descriptor);
|
||||
}
|
||||
|
||||
switch_status_t load_configuration(switch_bool_t reload)
|
||||
{
|
||||
@@ -657,7 +663,8 @@ switch_status_t load_configuration(switch_bool_t reload)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to allocate tone_descriptor: %s\n", name);
|
||||
switch_goto_status(SWITCH_STATUS_FALSE, done);
|
||||
}
|
||||
switch_core_hash_insert(spandsp_globals.tones, name, descriptor);
|
||||
|
||||
switch_core_hash_insert_destructor(spandsp_globals.tones, name, descriptor, destroy_descriptor);
|
||||
|
||||
/* add tones to descriptor */
|
||||
for (tone = switch_xml_child(xdescriptor, "tone"); tone; tone = switch_xml_next(tone)) {
|
||||
@@ -830,6 +837,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown)
|
||||
switch_core_destroy_memory_pool(&spandsp_globals.config_pool);
|
||||
}
|
||||
|
||||
memset(&spandsp_globals, 0, sizeof(spandsp_globals));
|
||||
|
||||
return SWITCH_STATUS_UNLOAD;
|
||||
}
|
||||
|
||||
|
||||
@@ -1645,7 +1645,6 @@ void mod_spandsp_fax_shutdown(void)
|
||||
t38_state_list.thread_running = 0;
|
||||
wake_thread(1);
|
||||
switch_thread_join(&tstatus, t38_state_list.thread);
|
||||
memset(&spandsp_globals, 0, sizeof(spandsp_globals));
|
||||
}
|
||||
|
||||
static const switch_state_handler_table_t t38_gateway_state_handlers;
|
||||
|
||||
Reference in new issue
Block a user