diff options
author | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-12-30 17:12:06 +0000 |
---|---|---|
committer | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-12-30 17:12:06 +0000 |
commit | 35096dbb8ce8ea359a0e929f3312cf1299c8ab20 (patch) | |
tree | 98cb855ebab1c1f9bdc7dfa8da4125791b96a0a0 | |
parent | ae23e2f86aca05ab734d731e6c2e456d4d89a8c0 (diff) |
BUILD : 1.7.6 (515) BUGS : 261 NOTES : Fixed a few memleaks with moduleData functions returning early, and fixed the list handling with deleting moduleData (thanks DrStein)
git-svn-id: svn://svn.anope.org/anope/trunk@515 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@369 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | src/modules.c | 24 | ||||
-rw-r--r-- | version.log | 6 |
3 files changed, 25 insertions, 9 deletions
@@ -13,9 +13,11 @@ Provided by Anope Dev. <dev@anope.org> - 2004 11/27 A OperServ SET SQL [on|off] disable/enable SQL during run time. [ #00] 11/21 A Opened SGLINE to all ircd that support GEOS bans. [ #00] 11/21 A Opened SZLINE to all ircd that support ZLINE's. [ #00] -11/19 A Added anope_cmd_ctcp() to code API, for sending CTCP messages. [ #00] +11/19 A Added anope_cmd_ctcp() to code API, for sending CTCP messages. [ #00] 11/18 A Unable to use registered nicknames as bot nicks from now on. [ #00] 11/18 A NSAddAccessOnReg to control access list on registration. [ #00] +12/30 F List handling of moduleData was bad on deletion. [#261] +12/30 F Few memleaks with moduleData functions returning early. [ #00] 12/30 F Modules can no longer add commands with mod_name set. [#261] 12/30 F Catserv now uses moduleAddCommand instead of addCommand. [#261] 12/27 F Not freeing memory when a channel got deleted. [ #00] diff --git a/src/modules.c b/src/modules.c index 64304e4af..4fa4c2c77 100644 --- a/src/modules.c +++ b/src/modules.c @@ -1818,12 +1818,18 @@ 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; ModuleData *tmp = *md; if (!key || !value) { alog("A module tried to use ModuleAddData() with one ore more NULL arguments... returning"); + free(mod_name); return MOD_ERR_PARAMS; } @@ -1837,6 +1843,7 @@ int moduleAddData(ModuleData ** md, char *key, char *value) newData = malloc(sizeof(ModuleData)); if (!newData) { + free(mod_name); return MOD_ERR_MEMORY; } @@ -1867,7 +1874,7 @@ int moduleAddData(ModuleData ** md, char *key, char *value) **/ char *moduleGetData(ModuleData ** md, char *key) { - + /* See comment in moduleAddData... -GD */ char *mod_name = sstrdup(mod_current_module_name); ModuleData *current = *md; @@ -1883,8 +1890,8 @@ char *moduleGetData(ModuleData ** md, char *key) } while (current) { - if ((stricmp(current->moduleName, mod_name) == 0) - && (stricmp(current->key, key) == 0)) { + if ((stricmp(current->moduleName, mod_name) == 0) && (stricmp(current->key, key) == 0)) { + free(mod_name); return sstrdup(current->value); } current = current->next; @@ -1901,6 +1908,7 @@ char *moduleGetData(ModuleData ** md, char *key) **/ void moduleDelData(ModuleData ** md, char *key) { + /* See comment in moduleAddData... -GD */ char *mod_name = sstrdup(mod_current_module_name); ModuleData *current = *md; ModuleData *prev = NULL; @@ -1915,8 +1923,7 @@ void moduleDelData(ModuleData ** md, char *key) if (key) { while (current) { next = current->next; - if ((stricmp(current->moduleName, mod_name) == 0) - && (stricmp(current->key, key) == 0)) { + if ((stricmp(current->moduleName, mod_name) == 0) && (stricmp(current->key, key) == 0)) { if (prev) { prev->next = current->next; } else { @@ -1927,8 +1934,9 @@ void moduleDelData(ModuleData ** md, char *key) free(current->value); current->next = NULL; free(current); + } else { + prev = current; } - prev = current; current = next; } } @@ -1943,6 +1951,7 @@ void moduleDelData(ModuleData ** md, char *key) **/ void moduleDelAllData(ModuleData ** md) { + /* See comment in moduleAddData... -GD */ char *mod_name = sstrdup(mod_current_module_name); ModuleData *current = *md; ModuleData *prev = NULL; @@ -1967,8 +1976,9 @@ void moduleDelAllData(ModuleData ** md) free(current->value); current->next = NULL; free(current); + } else { + prev = current; } - prev = current; current = next; } free(mod_name); diff --git a/version.log b/version.log index f3ecdf5f9..19fc24936 100644 --- a/version.log +++ b/version.log @@ -8,10 +8,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="6" -VERSION_BUILD="514" +VERSION_BUILD="515" # $Log$ # +# BUILD : 1.7.6 (515) +# BUGS : 261 +# NOTES : Fixed a few memleaks with moduleData functions returning early, and fixed the list handling with deleting moduleData (thanks DrStein) +# # BUILD : 1.7.6 (514) # BUGS : 261 # NOTES : Modules can no longer call addCommand directly. The mod_name of the command MUST be set if it is a module. |