diff options
Diffstat (limited to 'main/loader.c')
-rw-r--r-- | main/loader.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main/loader.c b/main/loader.c index 65c95ecc6..4516b3779 100644 --- a/main/loader.c +++ b/main/loader.c @@ -483,6 +483,9 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode f if (!error) ast_update_use_count(); + if (!error && !mod->lib) + mod->info->restore_globals(); + return res; } @@ -627,6 +630,11 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi return AST_MODULE_LOAD_DECLINE; } + if (!mod->lib && mod->info->backup_globals()) { + ast_log(LOG_WARNING, "Module '%s' was unable to backup its global data.\n", resource_name); + return AST_MODULE_LOAD_DECLINE; + } + ast_clear_flag(mod, FLAG_DECLINED); if (mod->info->load) |