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:
Mathieu Rene
2009-02-23 19:17:24 +00:00
parent 5a92bb1383
commit c4787ffd48
13 changed files with 88 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}