Merge pull request #1761 in FS/freeswitch from bugfix/FS-11952-fix-memory-leaks to master

* commit '718d2341f7327feea52c840648e42b33eb9c69dd':
  FS-11952: [Core] Fix memory leaks.
This commit is contained in:
Andrey Volk 2019-07-24 11:49:58 -05:00
commit e863053e92
11 changed files with 25 additions and 1 deletions

View File

@ -4274,6 +4274,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown)
queue = NULL; queue = NULL;
} }
switch_core_hash_destroy(&globals.queue_hash);
switch_safe_free(globals.odbc_dsn); switch_safe_free(globals.odbc_dsn);
switch_safe_free(globals.dbname); switch_safe_free(globals.dbname);
switch_safe_free(globals.cc_instance_id); switch_safe_free(globals.cc_instance_id);

View File

@ -788,6 +788,7 @@ void limit_remote_destroy(limit_remote_t **r)
switch_thread_rwlock_destroy((*r)->rwlock); switch_thread_rwlock_destroy((*r)->rwlock);
switch_core_destroy_memory_pool(&((*r)->pool)); switch_core_destroy_memory_pool(&((*r)->pool));
switch_core_hash_destroy(&(*r)->index);
*r = NULL; *r = NULL;
} }
} }

View File

@ -3242,6 +3242,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_httapi_shutdown)
switch_core_hash_destroy(&globals.profile_hash); switch_core_hash_destroy(&globals.profile_hash);
switch_core_hash_destroy(&globals.parse_hash); switch_core_hash_destroy(&globals.parse_hash);
switch_core_hash_destroy(&globals.request_hash);
while (globals.hash_root) { while (globals.hash_root) {
ptr = globals.hash_root; ptr = globals.hash_root;

View File

@ -37,11 +37,12 @@
/* Prototypes */ /* Prototypes */
SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load); SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_valet_parking_shutdown);
/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) /* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
* Defines a switch_loadable_module_function_table_t and a static const char[] modname * Defines a switch_loadable_module_function_table_t and a static const char[] modname
*/ */
SWITCH_MODULE_DEFINITION(mod_valet_parking, mod_valet_parking_load, NULL, NULL); SWITCH_MODULE_DEFINITION(mod_valet_parking, mod_valet_parking_load, mod_valet_parking_shutdown, NULL);
typedef struct { typedef struct {
char ext[256]; char ext[256];
@ -930,6 +931,12 @@ static void pres_event_handler(switch_event_t *event)
switch_safe_free(dup_lot_name); switch_safe_free(dup_lot_name);
} }
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_valet_parking_shutdown)
{
switch_core_hash_destroy(&globals.hash);
return SWITCH_STATUS_SUCCESS;
}
/* Macro expands to: switch_status_t mod_valet_parking_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */ /* Macro expands to: switch_status_t mod_valet_parking_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load) SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load)
{ {

View File

@ -555,6 +555,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_pg_csv_shutdown)
switch_event_unbind_callback(event_handler); switch_event_unbind_callback(event_handler);
switch_core_remove_state_handler(&state_handlers); switch_core_remove_state_handler(&state_handlers);
switch_core_hash_destroy(&globals.fd_hash);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }

View File

@ -1399,6 +1399,7 @@ void destroy_listener(listener_t * listener)
switch_mutex_unlock(listener->sock_mutex); switch_mutex_unlock(listener->sock_mutex);
switch_core_hash_destroy(&listener->event_hash); switch_core_hash_destroy(&listener->event_hash);
switch_core_hash_destroy(&listener->sessions);
/* remove any bindings for this connection */ /* remove any bindings for this connection */
remove_binding(listener, NULL); remove_binding(listener, NULL);

View File

@ -502,6 +502,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown)
switch_event_free_subclass(MULTICAST_PEERDOWN); switch_event_free_subclass(MULTICAST_PEERDOWN);
switch_core_hash_destroy(&globals.event_hash); switch_core_hash_destroy(&globals.event_hash);
switch_core_hash_destroy(&globals.peer_hash);
switch_safe_free(globals.address); switch_safe_free(globals.address);
switch_safe_free(globals.bindings); switch_safe_free(globals.bindings);

View File

@ -852,6 +852,7 @@ static void srgs_grammar_destroy(struct srgs_grammar *grammar)
switch_file_remove(grammar->jsgf_file_name, pool); switch_file_remove(grammar->jsgf_file_name, pool);
} }
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);
switch_core_hash_destroy(&grammar->rules);
} }
/** /**

View File

@ -2985,6 +2985,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_loadable_module_shutdown(); switch_loadable_module_shutdown();
switch_curl_destroy();
switch_ssl_destroy_ssl_locks(); switch_ssl_destroy_ssl_locks();
switch_scheduler_task_thread_stop(); switch_scheduler_task_thread_stop();
@ -3032,6 +3034,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir); switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.data_dir); switch_safe_free(SWITCH_GLOBAL_dirs.data_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.localstate_dir); switch_safe_free(SWITCH_GLOBAL_dirs.localstate_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.certs_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.lib_dir);
switch_safe_free(SWITCH_GLOBAL_filenames.conf_name);
switch_event_destroy(&runtime.global_vars); switch_event_destroy(&runtime.global_vars);
switch_core_hash_destroy(&runtime.ptimes); switch_core_hash_destroy(&runtime.ptimes);

View File

@ -351,6 +351,8 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_destroy()
msrp_deinit_ssl(); msrp_deinit_ssl();
switch_safe_free(globals.ip);
return st; return st;
} }

View File

@ -2451,6 +2451,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void)
switch_xml_clear_user_cache(NULL, NULL, NULL); switch_xml_clear_user_cache(NULL, NULL, NULL);
switch_core_hash_destroy(&CACHE_HASH); switch_core_hash_destroy(&CACHE_HASH);
switch_core_hash_destroy(&CACHE_EXPIRES_HASH);
return status; return status;
} }