It is possible for mod to become invalid after we unload it (if it's a dynamic module...
authorJoshua Colp <jcolp@digium.com>
Mon, 19 Mar 2007 22:32:40 +0000 (22:32 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 19 Mar 2007 22:32:40 +0000 (22:32 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59051 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/loader.c

index 838bcd2..ebad7fd 100644 (file)
@@ -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;
 }