]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7761 [core] fix shutdown races running api commands during shutdown
authorBrian West <brian@freeswitch.org>
Thu, 2 Jul 2015 15:08:54 +0000 (10:08 -0500)
committerMichael Jerris <mike@jerris.com>
Tue, 25 Aug 2015 19:45:25 +0000 (14:45 -0500)
src/switch_loadable_module.c
src/switch_time.c

index c9ec5f0e81aec5ec7473a2cf997fe9cb51eee6ba..ae8493cd66ab248eb0f04a1b3e4e2fa033b60984 100644 (file)
@@ -2070,8 +2070,8 @@ SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_inte
 
 #define HASH_FUNC(_kind_) SWITCH_DECLARE(switch_##_kind_##_interface_t *) switch_loadable_module_get_##_kind_##_interface(const char *name)    \
        {                                                                                                                                       \
-               switch_##_kind_##_interface_t *i;                                                               \
-               if ((i = switch_core_hash_find_locked(loadable_modules._kind_##_hash, name, loadable_modules.mutex))) { \
+               switch_##_kind_##_interface_t *i = NULL;                                                                \
+               if (loadable_modules._kind_##_hash && (i = switch_core_hash_find_locked(loadable_modules._kind_##_hash, name, loadable_modules.mutex))) {       \
                        PROTECT_INTERFACE(i);                                                                           \
                }                                                                                                                               \
                return i;                                                                                                               \
index be3debf560d366d024108f4d2af94c073ffc2788..db5d0359fe93cad0185df4afe3e69c6b36b9944f 100644 (file)
@@ -1362,7 +1362,11 @@ SWITCH_DECLARE(const char *) switch_lookup_timezone(const char *tz_name)
 {
        char *value = NULL;
 
-       if (tz_name && (value = switch_core_hash_find(TIMEZONES_LIST.hash, tz_name)) == NULL) {
+       if (zstr(tz_name) || !TIMEZONES_LIST.hash) {
+               return NULL;
+       }
+       
+       if ((value = switch_core_hash_find(TIMEZONES_LIST.hash, tz_name)) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timezone '%s' not found!\n", tz_name);
        }