summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-17 13:55:14 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-17 13:55:14 +0000
commit1735fc95bba84044d43d4490bd5916d0a52eb876 (patch)
tree19cc11399694432fd2cc2dcc258bd7bbfc84d2b0
parentfbd9bba660330f94e2e9c5b687e0fee25bd8f980 (diff)
Fix memory leak on rehash: opertype used char* instead of std::string
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11309 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/configreader.h2
-rw-r--r--src/configreader.cpp11
-rw-r--r--src/users.cpp2
3 files changed, 3 insertions, 12 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 7761ca94a..29289dcaf 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -224,7 +224,7 @@ struct MultiConfig
/** A set of oper types
*/
-typedef std::map<irc::string,char*> opertype_t;
+typedef std::map<irc::string,std::string> opertype_t;
/** Holds an oper class.
*/
diff --git a/src/configreader.cpp b/src/configreader.cpp
index e23f5750d..0fcf88e9d 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -2205,15 +2205,6 @@ bool ValueItem::GetBool()
*/
bool InitTypes(ServerConfig* conf, const char*)
{
- if (conf->opertypes.size())
- {
- for (opertype_t::iterator n = conf->opertypes.begin(); n != conf->opertypes.end(); n++)
- {
- if (n->second)
- delete[] n->second;
- }
- }
-
conf->opertypes.clear();
return true;
}
@@ -2250,7 +2241,7 @@ bool DoType(ServerConfig* conf, const char*, char**, ValueList &values, int*)
const char* TypeName = values[0].GetString();
const char* Classes = values[1].GetString();
- conf->opertypes[TypeName] = strnewdup(Classes);
+ conf->opertypes[TypeName] = std::string(Classes);
return true;
}
diff --git a/src/users.cpp b/src/users.cpp
index c84bc00d9..15e1ab72b 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -776,7 +776,7 @@ void User::Oper(const std::string &opertype, const std::string &opername)
this->AllowedUserModes['o' - 'A'] = true; // Call me paranoid if you want.
std::string myclass, mycmd, mypriv;
- irc::spacesepstream Classes(iter_opertype->second);
+ irc::spacesepstream Classes(iter_opertype->second.c_str());
while (Classes.GetToken(myclass))
{
operclass_t::iterator iter_operclass = ServerInstance->Config->operclass.find(myclass.c_str());