From e826b3f47e17d1d272c5e04a7f44e471e53ddf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 12 Apr 2005 08:55:03 +0000 Subject: [PATCH] put_module_image() is now again called independently from B_KEEP_LOADED - that has the advantage that module_image::ref_count does not get messed up, so we could still determine when to unload such a module (with an extra function). get_module() now calls put_module_image() if B_MODULE_INIT failed - failing modules were never unloaded before... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12343 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/module.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/kernel/core/module.c b/src/kernel/core/module.c index 320bd28b9b..3324cfaf04 100644 --- a/src/kernel/core/module.c +++ b/src/kernel/core/module.c @@ -1376,7 +1376,8 @@ get_module(const char *path, module_info **_info) if (status == B_OK) { inc_module_ref_count(module); *_info = module->info; - } + } else if ((module->flags & B_BUILT_IN_MODULE) == 0) + put_module_image(module->module_image); recursive_lock_unlock(&sModulesLock); return status; @@ -1408,11 +1409,11 @@ put_module(const char *path) if (module->ref_count == 0) uninit_module(module); - - if ((module->flags & B_BUILT_IN_MODULE) == 0) - put_module_image(module->module_image); } + if ((module->flags & B_BUILT_IN_MODULE) == 0) + put_module_image(module->module_image); + recursive_lock_unlock(&sModulesLock); return B_OK; }