From: Joshua Colp Date: Mon, 19 Mar 2007 22:32:40 +0000 (+0000) Subject: It is possible for mod to become invalid after we unload it (if it's a dynamic module... X-Git-Tag: 1.6.0-beta1~3^2~2986 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=42a36967c8f7405dd3b7c8115da887081b1828e7;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/loader.c b/main/loader.c index 838bcd27b5..ebad7fda6a 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; }