]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
JANITOR-4
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 21 Apr 2010 15:11:13 +0000 (10:11 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 21 Apr 2010 15:11:13 +0000 (10:11 -0500)
src/mod/endpoints/mod_loopback/mod_loopback.c
src/mod/formats/mod_sndfile/mod_sndfile.c
src/mod/loggers/mod_logfile/mod_logfile.c
src/switch.c
src/switch_core.c
src/switch_loadable_module.c
src/switch_time.c

index 8dde5042b6f1e6b4db8a42a4a985b4e2a04eecbf..9e11c5b474cc02d96b6e3672fdb5fd6311c9f970 100644 (file)
@@ -44,8 +44,6 @@ SWITCH_MODULE_DEFINITION(mod_loopback, mod_loopback_load, mod_loopback_shutdown,
 
 static switch_endpoint_interface_t *loopback_endpoint_interface = NULL;
 
-static switch_memory_pool_t *module_pool = NULL;
-
 typedef enum {
        TFLAG_LINKED = (1 << 0),
        TFLAG_OUTBOUND = (1 << 1),
@@ -887,10 +885,6 @@ static switch_io_routines_t channel_io_routines = {
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
 {
-       if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-               return SWITCH_STATUS_TERM;
-       }
 
        memset(&globals, 0, sizeof(globals));
 
index 020943ce5af7d3639cece48f6cce716c1a426589..c017ad9f06f6ebb40f4f732babc8885dae428217 100644 (file)
@@ -36,7 +36,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sndfile_shutdown);
 SWITCH_MODULE_DEFINITION(mod_sndfile, mod_sndfile_load, mod_sndfile_shutdown, NULL);
 
-static switch_memory_pool_t *module_pool = NULL;
 
 static struct {
        switch_hash_t *format_hash;
@@ -415,12 +414,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load)
 {
        switch_file_interface_t *file_interface;
 
-       if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-               return SWITCH_STATUS_TERM;
-       }
-
-       switch_core_hash_init(&globals.format_hash, module_pool);
+       switch_core_hash_init(&globals.format_hash, pool);
 
        if (setup_formats() != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
@@ -447,6 +441,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load)
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sndfile_shutdown)
 {
        switch_core_hash_destroy(&globals.format_hash);
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index 3645cb1ea154355c66cafdfa221a133e17720a05..8cdaf9615ab475c261fb97f72402409389b0f584 100644 (file)
@@ -398,9 +398,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown)
                if ((profile = (logfile_profile_t *) val)) {
                        switch_file_close(profile->log_afd);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Closing %s\n", profile->logfile);
+                       switch_safe_free(profile->logfile);
                }
        }
 
+       switch_core_hash_destroy(&profile_hash);
 
 
        return SWITCH_STATUS_SUCCESS;
index 5c761e372c179d3ee79dc44bc890c2d6f919cc0c..77aea8dc00d794b43cbc91a1a3c6f5b9c52c6eba 100644 (file)
@@ -791,6 +791,7 @@ int main(int argc, char *argv[])
        destroy_status = switch_core_destroy();
 
        switch_file_close(fd);
+       apr_pool_destroy(pool);
 
        if (unlink(pid_path) != 0) {
                fprintf(stderr, "Failed to delete pid file [%s]\n", pid_path);
index fe0ffcbaba1605d0bc857d5e8641b81f55ae9ddb..78296ebe7b478d361605cab4edec481fe40c5150 100644 (file)
@@ -1867,13 +1867,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
        switch_safe_free(SWITCH_GLOBAL_dirs.script_dir);
        switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir);
        switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir);
+       switch_safe_free(SWITCH_GLOBAL_dirs.storage_dir);
        switch_safe_free(SWITCH_GLOBAL_dirs.recordings_dir);
        switch_safe_free(SWITCH_GLOBAL_dirs.sounds_dir);
+       switch_safe_free(SWITCH_GLOBAL_dirs.run_dir);
        switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir);
 
        switch_core_hash_destroy(&runtime.global_vars);
        switch_core_hash_destroy(&runtime.mime_types);
 
+       if (IP_LIST.hash) {
+               switch_core_hash_destroy(&IP_LIST.hash);
+       }
+
+       if (IP_LIST.pool) {
+               switch_core_destroy_memory_pool(&IP_LIST.pool);
+       }
+
        if (runtime.memory_pool) {
                apr_pool_destroy(runtime.memory_pool);
                apr_terminate();
index 62ca41160938bd067fc7372b5731e85e325c2854..2e37585e52f67eb2e96306218883321f3e85d56b 100644 (file)
@@ -788,7 +788,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
        switch_loadable_module_interface_t *module_interface = NULL;
        char *derr = NULL;
        const char *err = NULL;
-       switch_memory_pool_t *pool;
+       switch_memory_pool_t *pool = NULL;
        switch_bool_t load_global = global;
 
        switch_assert(path != NULL);
@@ -1349,6 +1349,7 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void)
        switch_core_hash_destroy(&loadable_modules.management_hash);
        switch_core_hash_destroy(&loadable_modules.dialplan_hash);
 
+       switch_core_destroy_memory_pool(&loadable_modules.pool);
 }
 
 SWITCH_DECLARE(switch_endpoint_interface_t *) switch_loadable_module_get_endpoint_interface(const char *name)
index cbdc2f8eb14db9606e84e6ec67eff7920a39f0db..2d74e6059495604347cad751d434889dcf9218ad 100644 (file)
@@ -1064,6 +1064,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(softtimer_shutdown)
                switch_core_destroy_memory_pool(&TIMEZONES_LIST.pool);
        }
 
+       if (NODE) {
+               switch_event_unbind(&NODE);
+       }
+
        return SWITCH_STATUS_SUCCESS;
 }