diff options
author | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2005-10-26 21:07:36 +0000 |
---|---|---|
committer | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2005-10-26 21:07:36 +0000 |
commit | 08f523a2394c843c4ae22bffc3ea1b00c35a7c6f (patch) | |
tree | aae5c553e27c317bf6154b1c3947d48e8048d5c0 | |
parent | 60d406737051b3e4499df815ccefacd594a6f39d (diff) |
BUILD : 1.7.12 (917) BUGS : NOTES : Fixed module loading code to get rid of a few memory leaks and to (hopefully) correctly remove runtime copies when loading fails
git-svn-id: svn://svn.anope.org/anope/trunk@917 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@663 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | src/modules.c | 58 | ||||
-rw-r--r-- | version.log | 6 |
3 files changed, 44 insertions, 21 deletions
@@ -4,6 +4,7 @@ Provided by Anope Dev. <dev@anope.org> - 2005 10/01 A Information on uplink server can be displayed via OperServ STATS. [ #00] 09/29 A Configuration option to change fantasy command prefix character. [ #00] 09/28 A Event for fantasy commands triggered without channel access. [ #00] +10/25 F Memleaks and not removing tempfiles on failed module loading. [ #00] 10/25 F Help response for os random news was using opernews text. [ #00] 10/05 F Changed NickLen and BSFantasyChar into recommended and optional. [ #00] 10/04 F Added missing hs_request to win32 modules makefile. [ #00] diff --git a/src/modules.c b/src/modules.c index 1b2bc0966..b6d43c5d5 100644 --- a/src/modules.c +++ b/src/modules.c @@ -72,7 +72,9 @@ void modules_init(void) { #ifdef USE_MODULES int idx; + int ret; Module *m; + for (idx = 0; idx < ModulesNumber; idx++) { m = findModule(ModulesAutoload[idx]); if (!m) { @@ -80,7 +82,10 @@ void modules_init(void) mod_current_module = m; mod_current_user = NULL; alog("trying to load [%s]", mod_current_module->name); - alog("status: [%d]", loadModule(mod_current_module, NULL)); + ret = loadModule(mod_current_module, NULL); + alog("status: [%d]", ret); + if (ret != MOD_ERR_OK) + destroyModule(m); mod_current_module = NULL; mod_current_user = NULL; } @@ -109,6 +114,8 @@ void modules_core_init(int number, char **list) alog("debug: trying to load core module [%s]", mod_current_module->name); alog("debug: status: [%d]", status); + if (status != MOD_ERR_OK) + destroyModule(mod_current_module); } mod_current_module = NULL; mod_current_user = NULL; @@ -133,26 +140,30 @@ int protocol_module_init(void) alog("status: [%d]", ret); mod_current_module = NULL; - /* This is really NOT the correct place to do config checks, but - * as we only have the ircd struct filled here, we have to over - * here. -GD - */ - if (UseTokens && !(ircd->token)) { - alog("Anope does not support TOKENS for this ircd setting; unsetting UseToken"); - UseTokens = 0; - } - - if (UseTS6 && !(ircd->ts6)) { - alog("Chosen IRCd does not support TS6, unsetting UseTS6"); - UseTS6 = 0; + if (ret == MOD_ERR_OK) { + /* This is really NOT the correct place to do config checks, but + * as we only have the ircd struct filled here, we have to over + * here. -GD + */ + if (UseTokens && !(ircd->token)) { + alog("Anope does not support TOKENS for this ircd setting; unsetting UseToken"); + UseTokens = 0; + } + + if (UseTS6 && !(ircd->ts6)) { + alog("Chosen IRCd does not support TS6, unsetting UseTS6"); + UseTS6 = 0; + } + + /* We can assume the ircd supports TS6 here */ + if (UseTS6 && !Numeric) { + alog("UseTS6 requires the setting of Numeric to be enabled."); + ret = -1; + } + } else { + destroyModule(m); } - /* We can assume the ircd supports TS6 here */ - if (UseTS6 && !Numeric) { - alog("UseTS6 requires the setting of Numeric to be enabled."); - ret = -1; - } - return ret; } @@ -165,7 +176,9 @@ void modules_delayed_init(void) { #ifdef USE_MODULES int idx; + int ret; Module *m; + for (idx = 0; idx < ModulesDelayedNumber; idx++) { m = findModule(ModulesDelayedAutoload[idx]); if (!m) { @@ -173,9 +186,12 @@ void modules_delayed_init(void) mod_current_module = m; mod_current_user = NULL; alog("trying to load [%s]", mod_current_module->name); - alog("status: [%d]", loadModule(mod_current_module, NULL)); + ret = loadModule(mod_current_module, NULL); + alog("status: [%d]", ret); mod_current_module = NULL; mod_current_user = NULL; + if (ret != MOD_ERR_OK) + destroyModule(m); } } #endif @@ -2660,6 +2676,8 @@ void handleModuleOperationQueue(void) alog("Trying to load module [%s]", mod_operation_queue->m->name); status = loadModule(mod_operation_queue->m, mod_operation_queue->u); alog("Module loading status: %d", status); + if (status != MOD_ERR_OK) + destroyModule(mod_operation_queue->m); } else if (mod_operation_queue->op == MOD_OP_UNLOAD) { alog("Trying to unload module [%s]", mod_operation_queue->m->name); status = unloadModule(mod_operation_queue->m, mod_operation_queue->u); diff --git a/version.log b/version.log index 25f4bd8fe..5a06d4678 100644 --- a/version.log +++ b/version.log @@ -9,10 +9,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="12" VERSION_EXTRA="-rc1" -VERSION_BUILD="915" +VERSION_BUILD="917" # $Log$ # +# BUILD : 1.7.12 (917) +# BUGS : +# NOTES : Fixed module loading code to get rid of a few memory leaks and to (hopefully) correctly remove runtime copies when loading fails +# # BUILD : 1.7.12 (915) # BUGS : # NOTES : Fixed indenting errors in last commit (1.7.12-rc1) |