summaryrefslogtreecommitdiff
path: root/main/loader.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-03-19 22:32:40 +0000
committerJoshua Colp <jcolp@digium.com>2007-03-19 22:32:40 +0000
commit42a36967c8f7405dd3b7c8115da887081b1828e7 (patch)
tree6847c46873d28bd50374012e82d94519bc1fcc18 /main/loader.c
parent03aa8f7b8f0db4c2ee98392ecfdb26e9aa24b549 (diff)
It is possible for mod to become invalid after we unload it (if it's a dynamic module) so move it around a bit.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/loader.c')
-rw-r--r--main/loader.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main/loader.c b/main/loader.c
index 838bcd27b..ebad7fda6 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -475,6 +475,9 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode f
AST_LIST_UNLOCK(&module_list);
+ if (!error && !mod->lib)
+ mod->info->restore_globals();
+
#if LOADABLE_MODULES
if (!error)
unload_dynamic_module(mod);
@@ -483,9 +486,6 @@ 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;
}