]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix memory leak on rehash: opertype used char* instead of std::string
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 17 Apr 2009 13:55:14 +0000 (13:55 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 17 Apr 2009 13:55:14 +0000 (13:55 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11309 e03df62e-2008-0410-955e-edbf42e46eb7

include/configreader.h
src/configreader.cpp
src/users.cpp

index 7761ca94ad49b3eb139ab99c5ed87063b41f83b4..29289dcaf505a41d8948b91ea8c664ac3be67ce9 100644 (file)
@@ -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.
  */
index e23f5750d32f872aee18e621c9d7f746920a36ce..0fcf88e9da204a7d6ba25506575d54e38d7c4a84 100644 (file)
@@ -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;
 }
 
index c84bc00d9334f12d8f602b07e3fead71a0d48270..15e1ab72b5ebf79e57d0f475863332e90b80a1bf 100644 (file)
@@ -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());