[asterisk-commits] kpfleming: trunk r41196 - /trunk/main/loader.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Aug 26 12:45:17 MST 2006
Author: kpfleming
Date: Sat Aug 26 14:45:16 2006
New Revision: 41196
URL: http://svn.digium.com/view/asterisk?rev=41196&view=rev
Log:
ensure that unload_dynamic_module won't continue dereferencing a module pointer after the module has been unloaded from memory
Modified:
trunk/main/loader.c
Modified: trunk/main/loader.c
URL: http://svn.digium.com/view/asterisk/trunk/main/loader.c?rev=41196&r1=41195&r2=41196&view=diff
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Sat Aug 26 14:45:16 2006
@@ -323,9 +323,14 @@
#if LOADABLE_MODULES
static void unload_dynamic_module(struct ast_module *mod)
{
- if (mod->lib)
- while (!dlclose(mod->lib));
- /* WARNING: the structure pointed to by mod is now gone! */
+ void *lib = mod->lib;
+
+ /* WARNING: the structure pointed to by mod is going to
+ disappear when this operation succeeds, so we can't
+ dereference it */
+
+ if (lib)
+ while (!dlclose(lib));
}
static struct ast_module *load_dynamic_module(const char *resource_in, unsigned int global_symbols_only)
More information about the asterisk-commits
mailing list