From 42a36967c8f7405dd3b7c8115da887081b1828e7 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Mon, 19 Mar 2007 22:32:40 +0000 Subject: [PATCH] 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 --- main/loader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; }