diff options
| author | [email protected] <[email protected]> | 2012-03-18 04:26:22 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-03-18 04:26:22 +0000 |
| commit | 407f922a5b1036aacfb880a5366930a43ba9d109 (patch) | |
| tree | 82ad456efe2f96622390549752ccd80674e08b7f /src | |
| parent | b36c286036fab2f4673543bcd47df4dc8033073d (diff) | |
fix module unload issue
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2001 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src')
| -rw-r--r-- | src/module.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/module.c b/src/module.c index 390497d69d..8853919135 100644 --- a/src/module.c +++ b/src/module.c @@ -374,15 +374,15 @@ static struct rt_module* _load_shared_object(const char *name, void *module_ptr) if (module_size == 0) { rt_kprintf(" module size error\n"); - - return module; + return RT_NULL; } /* allocate module */ module = (struct rt_module *)rt_object_allocate(RT_Object_Class_Module, name); - if (!module) - return RT_NULL; + if (!module) return RT_NULL; + module->nref = 0; + /* allocate module space */ module->module_space = rt_malloc(module_size); if (module->module_space == RT_NULL) @@ -774,10 +774,10 @@ rt_module_t rt_module_load(const char *name, void *module_ptr) if (elf_module->e_entry != 0) { +#ifdef RT_USING_SLAB /* init module memory allocator */ module->mem_list = RT_NULL; -#ifdef RT_USING_SLAB /* create page array */ module->page_array = (void *)rt_malloc(PAGE_COUNT_MAX * sizeof(struct rt_page_info)); module->page_cnt = 0; @@ -1527,7 +1527,6 @@ void *rt_module_realloc(void *ptr, rt_size_t size) } } } -#endif #ifdef RT_USING_FINSH #include <finsh.h> @@ -1569,3 +1568,5 @@ FINSH_FUNCTION_EXPORT(list_mempage, list module using memory page information) #endif #endif + +#endif |
