summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2008-01-26 10:41:11 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2008-01-26 10:41:11 +0000
commit3e977708beb1cd13a0c66f2bdfb6f1303ab5e588 (patch)
tree62662db003ea16d35252cf22cbcf5536c1990bef
parent439c66311a0c04c5e447c86b23a5359d9adb37b3 (diff)
BUILD : 1.7.21 (1362) BUGS : 841 NOTES : Fixed memleaks in hs_setall
git-svn-id: svn://svn.anope.org/anope/trunk@1362 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1077 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes1
-rw-r--r--src/core/hs_setall.c38
-rw-r--r--version.log6
3 files changed, 40 insertions, 5 deletions
diff --git a/Changes b/Changes
index 43b03fcd5..cdc0051c0 100644
--- a/Changes
+++ b/Changes
@@ -14,6 +14,7 @@ Anope Version S V N
01/26 F Enough LogChannel checks for bs_say and bs_act with LogBot on. [#838]
01/26 F Memory leak and old code in ChanServ CLEAR. [#839]
01/26 F Memory leak in ChanServ LIST. [#840]
+01/26 F Memory leaks in HostServ SETALL. [#841]
Provided by Jan Milants <jan_renee@msn.com> - 2008
01/16 F Server traversion with next_server() failed to list all servers. [#831]
diff --git a/src/core/hs_setall.c b/src/core/hs_setall.c
index ca11e46ba..c3ec12fe2 100644
--- a/src/core/hs_setall.c
+++ b/src/core/hs_setall.c
@@ -72,7 +72,7 @@ int do_setall(User * u)
{
char *nick = strtok(NULL, " ");
- char *rawhostmask = strtok(NULL, " ");
+ char *rawhostmask = sstrdup(strtok(NULL, " "));
char *hostmask = smalloc(HOSTMAX);
NickAlias *na;
@@ -83,29 +83,47 @@ int do_setall(User * u)
if (!nick || !rawhostmask) {
notice_lang(s_HostServ, u, HOST_SETALL_SYNTAX, s_HostServ);
+ free(rawhostmask);
+ free(hostmask);
return MOD_CONT;
}
vIdent = myStrGetOnlyToken(rawhostmask, '@', 0); /* Get the first substring, @ as delimiter */
if (vIdent) {
+ free(rawhostmask);
rawhostmask = myStrGetTokenRemainder(rawhostmask, '@', 1); /* get the remaining string */
if (!rawhostmask) {
notice_lang(s_HostServ, u, HOST_SETALL_SYNTAX, s_HostServ);
+ if (vIdent)
+ free(vIdent);
+ free(hostmask);
return MOD_CONT;
}
if (strlen(vIdent) > USERMAX - 1) {
notice_lang(s_HostServ, u, HOST_SET_IDENTTOOLONG, USERMAX);
+ if (vIdent)
+ free(vIdent);
+ free(rawhostmask);
+ free(hostmask);
return MOD_CONT;
} else {
for (s = vIdent; *s; s++) {
if (!isvalidchar(*s)) {
notice_lang(s_HostServ, u, HOST_SET_IDENT_ERROR);
+ if (vIdent)
+ free(vIdent);
+ free(rawhostmask);
+ free(hostmask);
return MOD_CONT;
}
}
}
if (!ircd->vident) {
notice_lang(s_HostServ, u, HOST_NO_VIDENT);
+ if (vIdent)
+ free(vIdent);
+ free(rawhostmask);
+ free(hostmask);
return MOD_CONT;
}
}
@@ -114,12 +132,19 @@ int do_setall(User * u)
snprintf(hostmask, HOSTMAX - 1, "%s", rawhostmask);
else {
notice_lang(s_HostServ, u, HOST_SET_TOOLONG, HOSTMAX);
+ if (vIdent)
+ free(vIdent);
+ free(rawhostmask);
+ free(hostmask);
return MOD_CONT;
}
if (!isValidHost(hostmask, 3)) {
notice_lang(s_HostServ, u, HOST_SET_ERROR);
- free(hostmask);
+ if (vIdent)
+ free(vIdent);
+ free(rawhostmask);
+ free(hostmask);
return MOD_CONT;
}
@@ -128,7 +153,10 @@ int do_setall(User * u)
if ((na = findnick(nick))) {
if (na->status & NS_VERBOTEN) {
notice_lang(s_HostServ, u, NICK_X_FORBIDDEN, nick);
- free(hostmask);
+ if (vIdent)
+ free(vIdent);
+ free(rawhostmask);
+ free(hostmask);
return MOD_CONT;
}
if (vIdent && ircd->vident) {
@@ -146,7 +174,9 @@ int do_setall(User * u)
} else {
notice_lang(s_HostServ, u, HOST_NOREG, nick);
}
-
+ if (vIdent)
+ free(vIdent);
+ free(rawhostmask);
free(hostmask);
return MOD_CONT;
}
diff --git a/version.log b/version.log
index 4b536410f..a00b476a1 100644
--- a/version.log
+++ b/version.log
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="21"
VERSION_EXTRA="-svn"
-VERSION_BUILD="1361"
+VERSION_BUILD="1362"
# $Log$
#
+# BUILD : 1.7.21 (1362)
+# BUGS : 841
+# NOTES : Fixed memleaks in hs_setall
+#
# BUILD : 1.7.21 (1361)
# BUGS : 840
# NOTES : Fixed a memory leak in cs_list