mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 20:50:41 +00:00
Leaking on unload is strictly forbidden
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12251 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
5a92bb1383
commit
c4787ffd48
@ -426,6 +426,14 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_easyroute_shutdown)
|
||||
#ifdef SWITCH_HAVE_ODBC
|
||||
switch_odbc_handle_disconnect(globals.master_odbc);
|
||||
#endif
|
||||
|
||||
switch_safe_free(globals.db_username);
|
||||
switch_safe_free(globals.db_password);
|
||||
switch_safe_free(globals.db_dsn);
|
||||
switch_safe_free(globals.default_techprofile);
|
||||
switch_safe_free(globals.default_gateway);
|
||||
switch_safe_free(globals.custom_query);
|
||||
|
||||
return SWITCH_STATUS_UNLOAD;
|
||||
}
|
||||
|
||||
|
@ -850,6 +850,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
|
||||
if (globals.pool) {
|
||||
switch_core_destroy_memory_pool(&globals.pool);
|
||||
}
|
||||
|
||||
switch_safe_free(globals.root);
|
||||
switch_safe_free(globals.isn_root);
|
||||
|
||||
return SWITCH_STATUS_UNLOAD;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load);
|
||||
SWITCH_MODULE_DEFINITION(mod_dialplan_directory, mod_dialplan_directory_load, NULL, NULL);
|
||||
SWITCH_MODULE_DEFINITION(mod_dialplan_directory, mod_dialplan_directory_load, mod_dialplan_directory_shutdown, NULL);
|
||||
|
||||
static struct {
|
||||
char *directory_name;
|
||||
@ -142,11 +142,23 @@ SWITCH_STANDARD_DIALPLAN(directory_dialplan_hunt)
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
|
||||
{
|
||||
switch_safe_free(globals.directory_name);
|
||||
switch_safe_free(globals.host);
|
||||
switch_safe_free(globals.dn);
|
||||
switch_safe_free(globals.pass);
|
||||
switch_safe_free(globals.base);
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load)
|
||||
{
|
||||
switch_dialplan_interface_t *dp_interface;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
load_config();
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
SWITCH_ADD_DIALPLAN(dp_interface, "directory", directory_dialplan_hunt);
|
||||
|
@ -813,7 +813,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_alsa_load)
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
@ -939,6 +939,14 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_alsa_shutdown)
|
||||
switch_core_codec_destroy(&globals.write_codec);
|
||||
}
|
||||
switch_core_hash_destroy(&globals.call_hash);
|
||||
|
||||
switch_safe_free(globals.dialplan);
|
||||
switch_safe_free(globals.cid_name);
|
||||
switch_safe_free(globals.cid_num);
|
||||
switch_safe_free(globals.ring_file);
|
||||
switch_safe_free(globals.hold_file);
|
||||
switch_safe_free(globals.timer_name);
|
||||
switch_safe_free(globals.device_name);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -1748,6 +1748,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load)
|
||||
switch_api_interface_t *api_interface;
|
||||
|
||||
module_pool = pool;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
load_config();
|
||||
|
||||
@ -1889,6 +1891,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown)
|
||||
|
||||
|
||||
switch_core_hash_destroy(&globals.profile_hash);
|
||||
|
||||
switch_safe_free(globals.dialplan);
|
||||
switch_safe_free(globals.codec_string);
|
||||
switch_safe_free(globals.codec_rates_string);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -802,6 +802,8 @@ switch_io_routines_t iax_io_routines = {
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_iax_load)
|
||||
{
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
module_pool = pool;
|
||||
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
@ -1148,6 +1150,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_iax_shutdown)
|
||||
}
|
||||
switch_yield(20000);
|
||||
}
|
||||
|
||||
switch_safe_free(globals.dialplan);
|
||||
switch_safe_free(globals.codec_string);
|
||||
switch_safe_free(globals.codec_rates_string);
|
||||
switch_safe_free(globals.ip);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -532,6 +532,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_reference_load)
|
||||
|
||||
module_pool = pool;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
load_config();
|
||||
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
@ -565,6 +567,13 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_reference_shutdown)
|
||||
}
|
||||
switch_yield(20000);
|
||||
}
|
||||
|
||||
/* Free dynamically allocated strings */
|
||||
switch_safe_free(globals.dialplan);
|
||||
switch_safe_free(globals.codec_string);
|
||||
switch_safe_free(globals.codec_rates_string);
|
||||
switch_safe_free(globals.ip);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1071,6 +1071,13 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
|
||||
}
|
||||
}
|
||||
|
||||
switch_safe_free(globals.dialplan);
|
||||
switch_safe_free(globals.context);
|
||||
switch_safe_free(globals.destination);
|
||||
switch_safe_free(globals.codec_string);
|
||||
switch_safe_free(globals.codec_rates_string);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1296,7 +1296,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_erlang_event_load)
|
||||
{
|
||||
switch_application_interface_t *app_interface;
|
||||
switch_api_interface_t *api_interface;
|
||||
|
||||
|
||||
memset(&prefs, 0, sizeof(prefs));
|
||||
|
||||
switch_mutex_init(&globals.listener_mutex, SWITCH_MUTEX_NESTED, pool);
|
||||
|
||||
/* intialize the unique reference stuff */
|
||||
@ -1517,6 +1519,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_erlang_event_shutdown)
|
||||
|
||||
switch_sleep(1500000); /* sleep for 1.5 seconds */
|
||||
|
||||
switch_safe_free(prefs.ip);
|
||||
switch_safe_free(prefs.cookie);
|
||||
switch_safe_free(prefs.nodename);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -267,6 +267,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown)
|
||||
|
||||
switch_core_hash_destroy(&globals.event_hash);
|
||||
|
||||
switch_safe_free(globals.address);
|
||||
switch_safe_free(globals.bindings);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -471,6 +471,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown)
|
||||
|
||||
switch_event_unbind(&globals.node);
|
||||
|
||||
switch_safe_free(prefs.ip);
|
||||
switch_safe_free(prefs.password);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -933,6 +936,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load)
|
||||
switch_application_interface_t *app_interface;
|
||||
switch_api_interface_t *api_interface;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
switch_mutex_init(&globals.listener_mutex, SWITCH_MUTEX_NESTED, pool);
|
||||
|
||||
memset(&listen_list, 0, sizeof(listen_list));
|
||||
|
@ -152,6 +152,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_syslog_load)
|
||||
{
|
||||
switch_status_t status;
|
||||
*module_interface = &console_module_interface;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
@ -162,6 +164,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_syslog_load)
|
||||
setlogmask(LOG_UPTO(LOG_DEBUG));
|
||||
switch_log_bind_logger(mod_syslog_logger, log_level, SWITCH_FALSE);
|
||||
|
||||
switch_safe_free(globals.ident);
|
||||
switch_safe_free(globals.format);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -851,6 +851,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown)
|
||||
switch_yield(100000);
|
||||
} while (globals.running);
|
||||
|
||||
switch_safe_free(globals.realm);
|
||||
switch_safe_free(globals.user);
|
||||
switch_safe_free(globals.pass);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user