diff options
author | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-01-26 09:55:53 +0000 |
---|---|---|
committer | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-01-26 09:55:53 +0000 |
commit | 721a24ae219f0b062c63ce4f77a2c6ef34f08b94 (patch) | |
tree | 7d2cd2176c8638b9c4e9e7b170eb8b5560f7e0d4 /src | |
parent | b8bd618303e819c2cd9ee19de71379abbd5f39b8 (diff) |
BUILD : 1.7.21 (1354) BUGS : 833 NOTES : Ficed various oddities in moduleAddData()
git-svn-id: svn://svn.anope.org/anope/trunk@1354 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1069 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/modules.c b/src/modules.c index 13d4535cd..b71fd4f8b 100644 --- a/src/modules.c +++ b/src/modules.c @@ -2143,42 +2143,32 @@ int moduleDataDebug(ModuleData ** md) **/ int moduleAddData(ModuleData ** md, char *key, char *value) { - /* Do we really need this sstrdup here? Why can't we just use - * mod_current_module_name itself inside this function? It's not like - * we're changing it or anything, we just pass it to yet another - * sstrdup() somewhere down there.... -GD - */ - char *mod_name = sstrdup(mod_current_module_name); ModuleData *newData = NULL; - if (!key || !value) { - alog("A module tried to use ModuleAddData() with one ore more NULL arguments... returning"); - free(mod_name); - return MOD_ERR_PARAMS; - } - if (mod_current_module_name == NULL) { alog("moduleAddData() called with mod_current_module_name being NULL"); if (debug) do_backtrace(0); } + if (!key || !value) { + alog("A module (%s) tried to use ModuleAddData() with one or more NULL arguments... returning", mod_current_module_name); + return MOD_ERR_PARAMS; + } + moduleDelData(md, key); /* Remove any existing module data for this module with the same key */ newData = malloc(sizeof(ModuleData)); if (!newData) { - free(mod_name); return MOD_ERR_MEMORY; } - newData->moduleName = sstrdup(mod_name); + newData->moduleName = sstrdup(mod_current_module_name); newData->key = sstrdup(key); newData->value = sstrdup(value); newData->next = *md; *md = newData; - free(mod_name); - if (debug) { moduleDataDebug(md); } |