diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-24 13:28:07 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-24 13:28:07 +0000 |
commit | 5d407fb44c759524881712a80febb86b4506ddbf (patch) | |
tree | f0f426e645518a859ad25284f478854818a92da8 | |
parent | 009c5b0562c280743033ea6ca2e673201a8e218c (diff) |
delete operator tracking in debug mode (using a macro -- live with it.)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3904 e03df62e-2008-0410-955e-edbf42e46eb7
49 files changed, 175 insertions, 173 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index ecd09964b..3acd1b30f 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -42,6 +42,8 @@ */ #define IS_SINGLE(x,y) ( (*x == y) && (*(x+1) == 0) ) +#define DELETE(x) { log(DEBUG,__FILE__" ("__LINE__"): delete()"); delete x; } + template<typename T> inline std::string ConvToStr(const T &in) { std::stringstream tmp; diff --git a/src/channels.cpp b/src/channels.cpp index f07ad01bd..61d82a451 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -414,7 +414,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri if (n != chanlist.end()) { Ptr->DelUser(user); - delete Ptr; + DELETE(Ptr); chanlist.erase(n); for (unsigned int index =0; index < user->chans.size(); index++) { @@ -529,7 +529,7 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool { log(DEBUG,"del_channel: destroyed: %s",Ptr->name); FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(Ptr)); - delete Ptr; + DELETE(Ptr); chanlist.erase(iter); } } @@ -579,8 +579,8 @@ void server_kick_channel(userrec* user, chanrec* Ptr, char* reason, bool trigger if (iter != chanlist.end()) { log(DEBUG,"del_channel: destroyed: %s",Ptr->name); - FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(Ptr)); - delete Ptr; + FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(Ptr)); + DELETE(Ptr); chanlist.erase(iter); } } @@ -665,7 +665,7 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) { log(DEBUG,"del_channel: destroyed: %s",Ptr->name); FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(Ptr)); - delete Ptr; + DELETE(Ptr); chanlist.erase(iter); } } diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp index 82bba06e3..432970a0c 100644 --- a/src/cmd_kill.cpp +++ b/src/cmd_kill.cpp @@ -70,7 +70,7 @@ void cmd_kill::Handle (char **parameters, int pcnt, userrec *user) purge_empty_chans(u); } - delete u; + DELETE(u); } else { diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp index ff559ee7e..7c0b602e9 100644 --- a/src/cmd_quit.cpp +++ b/src/cmd_quit.cpp @@ -117,5 +117,5 @@ void cmd_quit::Handle (char **parameters, int pcnt, userrec *user) } if (user->fd > -1) fd_ref_table[user->fd] = NULL; - delete user; + DELETE(user); } diff --git a/src/dns.cpp b/src/dns.cpp index bdb7889a5..1da703c70 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -285,7 +285,7 @@ s_connection *dns_add_query(s_header *h) } if (s->fd == -1) { - delete s; + DELETE(s); return NULL; } /* create new connection object, add to linked list */ @@ -352,7 +352,7 @@ in_addr* DNS::dns_aton4_r(const char *ipstring) { /* ascii to numeric (reentrant ip = new in_addr; if(dns_aton4_s(ipstring,ip) == NULL) { - delete ip; + DELETE(ip); return NULL; } return ip; @@ -479,38 +479,38 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS dns_close(c->fd); if (l < 12) { - delete c; + DELETE(c); return NULL; } dns_fill_header(&h,buffer,l - 12); if (c->id[0] != h.id[0] || c->id[1] != h.id[1]) { log(DEBUG,"DNS: id mismatch on query"); - delete c; + DELETE(c); return NULL; /* ID mismatch */ } if ((h.flags1 & FLAGS1_MASK_QR) == 0) { log(DEBUG,"DNS: didnt get a query result"); - delete c; + DELETE(c); return NULL; } if ((h.flags1 & FLAGS1_MASK_OPCODE) != 0) { log(DEBUG,"DNS: got an OPCODE and didnt want one"); - delete c; + DELETE(c); return NULL; } if ((h.flags2 & FLAGS2_MASK_RCODE) != 0) { log(DEBUG,"DNS lookup failed due to SERVFAIL"); - delete c; + DELETE(c); return NULL; } if (h.ancount < 1) { log(DEBUG,"DNS: no answers!"); - delete c; + DELETE(c); return NULL; } i = 0; @@ -556,7 +556,7 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS } if (l - i < 10) { - delete c; + DELETE(c); return NULL; } dns_fill_rr(&rr,&h.payload[i]); @@ -627,7 +627,7 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS break; if (rr.rdlength != 4) { - delete c; + DELETE(c); return NULL; } memcpy(&alist->ip,&h.payload[i],4); @@ -654,7 +654,7 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS } if (l - i < 10) { - delete c; + DELETE(c); return NULL; } dns_fill_rr(&rr,&h.payload[i]); @@ -674,7 +674,7 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS res[rr.rdlength] = '\0'; break; } - delete c; + DELETE(c); return res; } diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index 73d80d11d..fee15febd 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -247,7 +247,7 @@ void dns_poll(int fdcheck) * from the socket engine, as dns.cpp tracks it * for us if we are in single-threaded country. */ - delete x; + DELETE(x); } } else @@ -255,7 +255,7 @@ void dns_poll(int fdcheck) /* its fd is dodgy, the dns code probably * bashed it due to error. Free the class. */ - delete x; + DELETE(x); } /* If we got down here, the dns lookup was valid, BUT, * its still in progress. Be patient, and wait for diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 354e16bc9..13716b78b 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -1229,7 +1229,7 @@ void purge_empty_chans(userrec* u) if (i2 != chanlist.end()) { FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(i2->second)); - delete i2->second; + DELETE(i2->second); chanlist.erase(i2); } } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 5e437365b..777cc595f 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -372,7 +372,7 @@ void InspIRCd::erase_module(int j) { if (v1 == j) { - delete *m; + DELETE(*m); modules.erase(m); modules.push_back(NULL); break; @@ -817,7 +817,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets) } } s->Close(); - delete s; + DELETE(s); } else if (!s) { @@ -947,7 +947,7 @@ int main(int argc, char** argv) { ServerInstance = new InspIRCd(argc, argv); ServerInstance->Run(); - delete ServerInstance; + DELETE(ServerInstance); } catch (std::bad_alloc) { diff --git a/src/mode.cpp b/src/mode.cpp index 3842b01e6..d2ecbf369 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -1293,7 +1293,7 @@ bool ModeParser::ProcessModuleUmode(char umode, userrec* source, void* dest, boo log(DEBUG,"No module claims umode %c",umode); if (faked) { - delete s2; + DELETE(s2); source = NULL; } return false; @@ -1302,7 +1302,7 @@ bool ModeParser::ProcessModuleUmode(char umode, userrec* source, void* dest, boo { if (faked) { - delete s2; + DELETE(s2); source = NULL; } return false; diff --git a/src/modules.cpp b/src/modules.cpp index 223b1fe30..ab49859fe 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -870,9 +870,9 @@ ConfigReader::~ConfigReader() //~ if (this->cache) //~ delete this->cache; if (this->errorlog) - delete this->errorlog; + DELETE(this->errorlog); if(this->privatehash) - delete this->data; + DELETE(this->data); } diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index 267fc71b4..58ca77333 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -91,8 +91,8 @@ class ModuleFilterPCRE : public Module virtual ~ModuleFilterPCRE() { - delete MyConf; - delete Conf; + DELETE(MyConf); + DELETE(Conf); } void Implements(char* List) @@ -156,8 +156,8 @@ class ModuleFilterPCRE : public Module { // reload our config file on rehash - we must destroy and re-allocate the classes // to call the constructor again and re-read our data. - delete Conf; - delete MyConf; + DELETE(Conf); + DELETE(MyConf); Conf = new ConfigReader; std::string filterfile = Conf->ReadValue("filter","file",0); // this automatically re-reads the configuration file into the class diff --git a/src/modules/extra/m_sql.cpp b/src/modules/extra/m_sql.cpp index ef3fbf21d..1c5da9366 100644 --- a/src/modules/extra/m_sql.cpp +++ b/src/modules/extra/m_sql.cpp @@ -333,12 +333,12 @@ class ModuleSQL : public Module virtual ~ModuleSQL() { Connections.clear(); - delete Conf; + DELETE(Conf); } virtual void OnRehash(const std::string ¶meter) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader(); LoadDatabases(Conf); } diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index d5ccc20d7..f27c0c28b 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -68,7 +68,7 @@ class ModuleSQLAuth : public Module { encryption.append("("); } - delete Conf; + DELETE(Conf); SQLModule = Srv->FindModule("m_sql.so"); if (!SQLModule) Srv->Log(DEFAULT,"WARNING: m_sqlauth.so could not initialize because m_sql.so is not loaded. Load the module and rehash your server."); @@ -170,8 +170,8 @@ class ModuleSQLAuth : public Module found = false; } - delete rowrequest; - delete rowresult; + DELETE(rowrequest); + DELETE(rowresult); } else { @@ -185,8 +185,8 @@ class ModuleSQLAuth : public Module Request donerequest((char*)query, this, SQLModule); donerequest.Send(); - delete query; - delete result; + DELETE(query); + DELETE(result); return found; } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 845c3e0d9..84dd8fa43 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -50,7 +50,7 @@ class ModuleSQLLog : public Module { Conf = new ConfigReader(); dbid = Conf->ReadInteger("sqllog","dbid",0,true); // database id of a database configured in m_sql (see m_sql config) - delete Conf; + DELETE(Conf); SQLModule = Srv->FindModule("m_sql.so"); if (!SQLModule) Srv->Log(DEFAULT,"WARNING: m_SQLLog.so could not initialize because m_sql.so is not loaded. Load the module and rehash your server."); @@ -92,18 +92,18 @@ class ModuleSQLLog : public Module if (rowresult->GetType() == SQL_ROW) { nid = atoi(rowresult->GetField("id").c_str()); - delete rowresult; + DELETE(rowresult); } - delete rowrequest; - delete result; + DELETE(rowrequest); + DELETE(result); } query->SetQueryType(SQL_DONE); query->SetConnID(dbid); Request donerequest((char*)query, this, SQLModule); donerequest.Send(); - delete query; + DELETE(query); if (nid < 1) { @@ -117,9 +117,9 @@ class ModuleSQLLog : public Module } if (result2) - delete result; + DELETE(result); if (query2) - delete query2; + DELETE(query2); nid = InsertNick(nick); } @@ -141,9 +141,9 @@ class ModuleSQLLog : public Module } if (result) - delete result; + DELETE(result); if (query) - delete query; + DELETE(query); return; } @@ -165,18 +165,18 @@ class ModuleSQLLog : public Module if (rowresult->GetType() == SQL_ROW) { hid = atoi(rowresult->GetField("id").c_str()); - delete rowresult; + DELETE(rowresult); } - delete rowrequest; - delete result; + DELETE(rowrequest); + DELETE(result); } query->SetQueryType(SQL_DONE); query->SetConnID(dbid); Request donerequest((char*)query, this, SQLModule); donerequest.Send(); - delete query; + DELETE(query); if (hid < 1) { @@ -190,9 +190,9 @@ class ModuleSQLLog : public Module } if (result) - delete result2; + DELETE(result2); if (query) - delete query2; + DELETE(query2); hid = InsertHost(host); } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 5a039d069..8707f1580 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -72,7 +72,7 @@ class ModuleSQLOper : public Module virtual void OnRehash(const std::string ¶meter) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader(); ReadConfig(); } @@ -186,7 +186,7 @@ class ModuleSQLOper : public Module } } - delete rowresult; + DELETE(rowresult); } else { @@ -194,8 +194,8 @@ class ModuleSQLOper : public Module found = false; } - delete rowrequest; - delete result; + DELETE(rowrequest); + DELETE(result); } else { @@ -206,13 +206,13 @@ class ModuleSQLOper : public Module query->SetConnID(dbid); Request donerequest((char*)query, this, SQLModule); donerequest.Send(); - delete query; + DELETE(query); return found; } virtual ~ModuleSQLOper() { - delete Conf; + DELETE(Conf); } virtual Version GetVersion() diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 52209d44c..5be9e7bcc 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -174,7 +174,7 @@ class ModuleSSLGnuTLS : public Module // This may be on a large (once a day or week) timer eventually. GenerateDHParams(); - delete Conf; + DELETE(Conf); } void GenerateDHParams() @@ -564,8 +564,8 @@ class ModuleSSLGnuTLS : public Module metadata->push_back("ON"); // The value to send Event* event = new Event((char*)metadata,(Module*)this,"send_metadata"); event->Send(); // Trigger the event. We don't care what module picks it up. - delete event; - delete metadata; + DELETE(event); + DELETE(metadata); } } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 1e20b1ccf..b1d8af21c 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -210,7 +210,7 @@ class ModuleSSLOpenSSL : public Module log(DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters"); } - delete Conf; + DELETE(Conf); } virtual ~ModuleSSLOpenSSL() @@ -628,8 +628,8 @@ class ModuleSSLOpenSSL : public Module metadata->push_back("ON"); // The value to send Event* event = new Event((char*)metadata,(Module*)this,"send_metadata"); event->Send(); // Trigger the event. We don't care what module picks it up. - delete event; - delete metadata; + DELETE(event); + DELETE(metadata); } } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 80b55e0a4..bd6c001b3 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -79,7 +79,7 @@ class ModuleAlias : public Module virtual ~ModuleAlias() { - delete MyConf; + DELETE(MyConf); } virtual Version GetVersion() @@ -150,7 +150,7 @@ class ModuleAlias : public Module virtual void OnRehash(const std::string ¶meter) { - delete MyConf; + DELETE(MyConf); MyConf = new ConfigReader; ReadAliases(); diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 95dfa40c4..0472e2417 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -91,7 +91,7 @@ public: else action = IBLOCK_KILLOPERS; - delete Conf; + DELETE(Conf); } virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) @@ -171,7 +171,7 @@ public: BlockedMessage* m = (BlockedMessage*)user->GetExt("amsgblock"); if(m) { - delete m; + DELETE(m); user->Shrink("amsgblock"); } } diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index ee1a63424..6a5acb54c 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -164,8 +164,8 @@ class ModuleCensor : public Module irc::string replace = (MyConf->ReadValue("badword","replace",index)).c_str(); censors[pattern] = replace; } - delete Conf; - delete MyConf; + DELETE(Conf); + DELETE(MyConf); } virtual Version GetVersion() diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 9e8d36ff8..b9fe2225f 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -67,14 +67,14 @@ class ModuleChanFilter : public Module if (spamlist) { channel->Shrink("spam_list"); - delete spamlist; + DELETE(spamlist); } } } virtual void OnRehash(const std::string ¶meter) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader; // re-read our config options on a rehash MaxEntries = Conf->ReadInteger("chanfilter","maxsize",0,true); @@ -195,7 +195,7 @@ class ModuleChanFilter : public Module virtual ~ModuleChanFilter() { - delete Conf; + DELETE(Conf); } virtual Version GetVersion() diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index b6f277c03..0839a48e4 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -81,7 +81,7 @@ class ModuleChanProtect : public Module virtual void OnRehash(const std::string ¶meter) { // on a rehash we delete our classes for good measure and create them again. - delete Conf; + DELETE(Conf); Conf = new ConfigReader; // re-read our config options on a rehash FirstInGetsFounder = Conf->ReadFlag("options","noservices",0); @@ -318,7 +318,7 @@ class ModuleChanProtect : public Module virtual ~ModuleChanProtect() { - delete Conf; + DELETE(Conf); } virtual Version GetVersion() diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index f67021af5..804026adb 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -21,7 +21,7 @@ char* RandString(unsigned int length) out[length] = '\0'; - delete tmp; + DELETE(tmp); return (char*)out; } @@ -56,7 +56,7 @@ class ModuleWaitPong : public Module if(Conf->GetError() == CONF_VALUE_NOT_FOUND) killonbadreply = true; - delete Conf; + DELETE(Conf); } void Implements(char* List) @@ -86,7 +86,7 @@ class ModuleWaitPong : public Module { if(strcmp(pingrpl, parameters[0]) == 0) { - delete pingrpl; + DELETE(pingrpl); user->Shrink("waitpong_pingstr"); return 1; } @@ -113,7 +113,7 @@ class ModuleWaitPong : public Module if(pingrpl) { - delete pingrpl; + DELETE(pingrpl); user->Shrink("waitpong_pingstr"); } } @@ -127,7 +127,7 @@ class ModuleWaitPong : public Module if(pingrpl) { - delete pingrpl; + DELETE(pingrpl); user->Shrink("waitpong_pingstr"); } } diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index cfa96e2b3..67e4da607 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -38,13 +38,13 @@ class ModuleDenyChannels : public Module virtual void OnRehash(const std::string ¶m) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader; } virtual ~ModuleDenyChannels() { - delete Conf; + DELETE(Conf); } virtual Version GetVersion() diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 929ae6456..d183ce2f7 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -140,7 +140,7 @@ class ModuleFilter : public Module } for (filter_t::iterator n = filters.begin(); n != filters.end(); n++) { - delete n->second; + DELETE(n->second); } filters.clear(); for (int index = 0; index < MyConf->Enumerate("keyword"); index++) @@ -156,8 +156,8 @@ class ModuleFilter : public Module filters[pattern] = x; } Srv->Log(DEFAULT,std::string("m_filter: read configuration from ")+filterfile); - delete Conf; - delete MyConf; + DELETE(Conf); + DELETE(MyConf); } virtual Version GetVersion() diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 966f645d3..b6c723ca7 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -216,9 +216,9 @@ class ModuleHelpop : public Module virtual void OnRehash(const std::string ¶meter) { - delete conf; + DELETE(conf); if (helpop) - delete helpop; + DELETE(helpop); ReadConfig(); } @@ -242,8 +242,8 @@ class ModuleHelpop : public Module virtual ~ModuleHelpop() { - delete conf; - delete helpop; + DELETE(conf); + DELETE(helpop); } virtual Version GetVersion() diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index a4a5a8b08..21333a853 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -52,7 +52,7 @@ class ModuleHostChange : public Module virtual ~ModuleHostChange() { - delete Conf; + DELETE(Conf); } Priority Prioritize() @@ -67,12 +67,12 @@ class ModuleHostChange : public Module virtual void OnRehash(const std::string ¶meter) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader; MySuffix = Conf->ReadValue("host","suffix",0); for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++) { - delete i->second; + DELETE(i->second); } hostchanges.clear(); for (int index = 0; index < Conf->Enumerate("hostchange"); index++) diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 9136d1349..2669c9254 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -149,7 +149,7 @@ class ModuleIdent : public Module IdentTimeout = Conf->ReadInteger("ident","timeout",0,true); if (!IdentTimeout) IdentTimeout = 1; - delete Conf; + DELETE(Conf); } ModuleIdent(Server* Me) @@ -187,7 +187,7 @@ class ModuleIdent : public Module else { Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :*** Could not find your ident, using "+std::string(user->ident)+" instead."); - delete ident; + DELETE(ident); } } diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index b1dc5c657..ae31ab67c 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -165,7 +165,7 @@ class ModuleJoinFlood : public Module if (c->GetExt("joinflood")) { joinfloodsettings *f = (joinfloodsettings*)c->GetExt("joinflood"); - delete f; + DELETE(f); c->Shrink("joinflood"); } } @@ -211,7 +211,7 @@ class ModuleJoinFlood : public Module if (chan->GetExt("joinflood")) { joinfloodsettings *f = (joinfloodsettings*)chan->GetExt("joinflood"); - delete f; + DELETE(f); chan->Shrink("joinflood"); } } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 18fd995ad..3910bc030 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -46,7 +46,7 @@ public: if (dl) { - delete dl; + DELETE(dl); c->Shrink("norejoinusers"); } } @@ -95,38 +95,38 @@ public: if (!dl->size()) { // Now it's empty.. - delete dl; - chan->Shrink("norejoinusers"); + DELETE(dl); + chan->Shrink("norejoinusers"); + } } } + return 0; } - return 0; - } - - virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) - { - if (chan->IsModeSet('J') && (source != user)) + + virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) { - delaylist* dl = (delaylist*)chan->GetExt("norejoinusers"); - - if (!dl) + if (chan->IsModeSet('J') && (source != user)) { - dl = new delaylist; - chan->Extend("norejoinusers", (char*)dl); + delaylist* dl = (delaylist*)chan->GetExt("norejoinusers"); + + if (!dl) + { + dl = new delaylist; + chan->Extend("norejoinusers", (char*)dl); + } + + log(DEBUG, "m_kicknorejoin.so: setting record for %s, %d second delay", user->nick, strtoint(chan->GetModeParameter('J'))); + (*dl)[user] = time(NULL) + strtoint(chan->GetModeParameter('J')); } - - log(DEBUG, "m_kicknorejoin.so: setting record for %s, %d second delay", user->nick, strtoint(chan->GetModeParameter('J'))); - (*dl)[user] = time(NULL) + strtoint(chan->GetModeParameter('J')); } - } - - virtual void OnChannelDelete(chanrec* chan) - { - delaylist* dl = (delaylist*)chan->GetExt("norejoinusers"); - if (dl) + virtual void OnChannelDelete(chanrec* chan) { - delete dl; + delaylist* dl = (delaylist*)chan->GetExt("norejoinusers"); + + if (dl) + { + DELETE(dl); chan->Shrink("norejoinusers"); } } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 61682c26f..c5df268ea 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -163,7 +163,7 @@ class ModuleMsgFlood : public Module if (c->GetExt("flood")) { floodsettings *f = (floodsettings*)c->GetExt("flood"); - delete f; + DELETE(f); c->Shrink("flood"); } } @@ -219,7 +219,7 @@ class ModuleMsgFlood : public Module if (chan->GetExt("flood")) { floodsettings *f = (floodsettings*)chan->GetExt("flood"); - delete f; + DELETE(f); chan->Shrink("flood"); } } diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 2517b385f..c33400954 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -32,13 +32,13 @@ class ModuleOperjoin : public Module virtual void OnRehash(const std::string ¶meter) { - delete conf; + DELETE(conf); conf = new ConfigReader; } virtual ~ModuleOperjoin() { - delete conf; + DELETE(conf); } virtual Version GetVersion() diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 306dbe587..8df45f0fc 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -28,7 +28,7 @@ class ModuleOperLevels : public Module virtual ~ModuleOperLevels() { - delete conf; + DELETE(conf); } void Implements(char* List) @@ -38,7 +38,7 @@ class ModuleOperLevels : public Module virtual void OnRehash(const std::string ¶meter) { - delete conf; + DELETE(conf); conf = new ConfigReader; } diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 6bf823d31..c46b8beaf 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -45,13 +45,13 @@ class ModuleModesOnOper : public Module virtual void OnRehash(const std::string ¶meter) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader; } virtual ~ModuleModesOnOper() { - delete Conf; + DELETE(Conf); } virtual Version GetVersion() diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index c43775db8..5f9dafa65 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -21,7 +21,7 @@ void LoadOperMOTD() filename = conf->ReadValue("opermotd","file",0); opermotd->LoadFile(filename); - delete conf; + DELETE(conf); } void ShowOperMOTD(userrec* user) diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 16c3a5295..64ce9cff6 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -58,7 +58,7 @@ class ModuleOverride : public Module overrides[typen] = tokenlist; } - delete Conf; + DELETE(Conf); } void Implements(char* List) diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 935efa39c..7abe31baf 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -176,7 +176,7 @@ class cmd_unpark : public command_t timebuf[strlen(timebuf)-1] = '\0'; WriteServ(unpark->fd,"NOTICE %s :From %s at %s: \2%s\2",unpark->nick,i->from.c_str(),timebuf,i->text.c_str()); } - delete awy; + DELETE(awy); unpark->Shrink("park_awaylog"); unpark->Shrink("park_key"); for (parkinfo::iterator j = pinfo.begin(); j != pinfo.end(); j++) @@ -209,7 +209,7 @@ class ModulePark : public Module ParkMaxTime = Conf->ReadInteger("park","maxtime",0,true); ConcurrentParks = Conf->ReadInteger("park","maxperip",0,true); ParkMaxMsgs = Conf->ReadInteger("park","maxmessages",0,true); - delete Conf; + DELETE(Conf); } ModulePark(Server* Me) diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index a3b4c4a7e..64c967ae8 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -122,8 +122,8 @@ class ModuleRandQuote : public Module virtual ~ModuleRandQuote() { - delete conf; - delete quotes; + DELETE(conf); + DELETE(quotes); } virtual Version GetVersion() diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index cd94ba3fe..a901dfde6 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -42,7 +42,7 @@ class ModuleRestrictChans : public Module irc::string channel = txt.c_str(); allowchans[channel] = 1; } - delete MyConf; + DELETE(MyConf); } public: diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index e9ea965f9..0ba1f28a1 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -80,7 +80,7 @@ class ListTimer : public InspTimer if (ld->list_position > Srv->GetChannelCount()) { u->Shrink("safelist_cache"); - delete ld; + DELETE(ld); listusers.erase(iter); go_again = true; break; @@ -202,7 +202,7 @@ class ModuleSafeList : public Module return 1; } - delete last_list_time; + DELETE(last_list_time); user->Shrink("safelist_last"); } @@ -229,7 +229,7 @@ class ModuleSafeList : public Module if (ld) { u->Shrink("safelist_cache"); - delete ld; + DELETE(ld); } for (UserList::iterator iter = listusers.begin(); iter != listusers.end(); iter++) { @@ -243,7 +243,7 @@ class ModuleSafeList : public Module time_t* last_list_time = (time_t*)u->GetExt("safelist_last"); if (last_list_time) { - delete last_list_time; + DELETE(last_list_time); u->Shrink("safelist_last"); } } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 4beda4423..dea78c526 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -91,7 +91,7 @@ class cmd_silence : public command_t { // tidy up -- if a user's list is empty, theres no use having it // hanging around in the user record. - delete sl; + DELETE(sl); user->Shrink("silence_list"); } } @@ -153,7 +153,7 @@ class ModuleSilence : public Module silencelist* sl = (silencelist*)user->GetExt("silence_list"); if (sl) { - delete sl; + DELETE(sl); user->Shrink("silence_list"); } } diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index eb4db1335..c36005fb2 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -455,7 +455,7 @@ class TreeServer TreeServer* s = (TreeServer*)*a; s->Tidy(); Children.erase(a); - delete s; + DELETE(s); stillchildren = true; break; } @@ -658,9 +658,9 @@ class TreeSocket : public InspSocket ~TreeSocket() { if (ctx_in) - delete ctx_in; + DELETE(ctx_in); if (ctx_out) - delete ctx_out; + DELETE(ctx_out); } void InitAES(std::string key,std::string SName) @@ -887,7 +887,7 @@ class TreeSocket : public InspSocket SquitServer(from, Current); Current->Tidy(); Current->GetParent()->DelChild(Current); - delete Current; + DELETE(Current); WriteOpers("Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers); } else @@ -911,7 +911,7 @@ class TreeSocket : public InspSocket } Srv->SendMode(modelist,params.size(),who); DoOneToAllButSender(source,"FMODE",params,source); - delete who; + DELETE(who); return true; } @@ -2839,7 +2839,7 @@ void ReadConfiguration(bool rebind) { log(DEFAULT,"m_spanningtree: Warning: Failed to bind server port %d",Port); listener->Close(); - delete listener; + DELETE(listener); } } } @@ -2889,7 +2889,7 @@ void ReadConfiguration(bool rebind) } } } - delete Conf; + DELETE(Conf); } @@ -3229,7 +3229,7 @@ class ModuleSpanningTree : public Module else { WriteOpers("*** AUTOCONNECT: Error autoconnecting \002%s\002: %s.",x->Name.c_str(),strerror(errno)); - delete newsocket; + DELETE(newsocket); } } } @@ -3291,7 +3291,7 @@ class ModuleSpanningTree : public Module else { WriteServ(user->fd,"NOTICE %s :*** CONNECT: Error connecting \002%s\002: %s.",user->nick,x->Name.c_str(),strerror(errno)); - delete newsocket; + DELETE(newsocket); } return 1; } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index a4d947102..98ed007d0 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -56,7 +56,7 @@ class cmd_swhois : public command_t WriteOpers("*** %s used SWHOIS to set %s's extra whois from '%s' to '%s'", user->nick, dest->nick, text->c_str(), line.c_str()); dest->Shrink("swhois"); - delete text; + DELETE(text); } else if(!Srv->IsUlined(user->server)) { @@ -87,7 +87,7 @@ class ModuleSWhois : public Module void OnRehash(const std::string ¶meter) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader(); } @@ -138,7 +138,7 @@ class ModuleSWhois : public Module { std::string* swhois = (std::string*)field; user->Shrink("swhois"); - delete swhois; + DELETE(swhois); } } @@ -153,7 +153,7 @@ class ModuleSWhois : public Module { std::string* swhois = (std::string*)field; user->Shrink("swhois"); - delete swhois; + DELETE(swhois); } } } @@ -195,7 +195,7 @@ class ModuleSWhois : public Module if(std::string* old = (std::string*)user->GetExt("swhois")) { user->Shrink("swhois"); - delete old; + DELETE(old); } std::string* text = new std::string(swhois); @@ -209,7 +209,7 @@ class ModuleSWhois : public Module virtual ~ModuleSWhois() { - delete Conf; + DELETE(Conf); } virtual Version GetVersion() diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 98a76ad63..b1b0de25f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -170,7 +170,7 @@ class ModuleTimedBans : public Module temp->fd = FD_MAGIC_NUMBER; temp->server = ""; Srv->SendMode(setban,3,temp); - delete temp; + DELETE(temp); } // we used to delete the item here, but we dont need to as the servermode above does it for us, break; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index a2e77f091..f419772d4 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -72,7 +72,7 @@ class ModuleVHost : public Module virtual ~ModuleVHost() { - delete Conf; + DELETE(Conf); } void Implements(char* List) @@ -82,7 +82,7 @@ class ModuleVHost : public Module virtual void OnRehash(const std::string ¶meter) { - delete Conf; + DELETE(Conf); Conf = new ConfigReader; } diff --git a/src/timer.cpp b/src/timer.cpp index 6ccdbb9bd..f35a9c67b 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -41,11 +41,11 @@ void TickTimers(time_t TIME) { InspTimer* n = *y; n->Tick(TIME); - delete n; + DELETE(n); } Timers.erase(found); - delete x; + DELETE(x); } } @@ -69,11 +69,11 @@ void TickMissedTimers(time_t TIME) { InspTimer* z = *y; z->Tick(TIME); - delete z; + DELETE(z); } Timers.erase(found); - delete x; + DELETE(x); } } } diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 2adccc36e..e9860b594 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -324,7 +324,7 @@ void DoSocketTimeouts(time_t TIME) SE->DelFd(s->GetFd()); module_sockets.erase(a); s->Close(); - delete s; + DELETE(s); break; } diff --git a/src/users.cpp b/src/users.cpp index d4919af06..41f1f097c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -139,7 +139,7 @@ userrec::~userrec() for (std::vector<ucrec*>::iterator n = chans.begin(); n != chans.end(); n++) { ucrec* x = (ucrec*)*n; - delete x; + DELETE(x); } } @@ -543,7 +543,7 @@ void kill_link(userrec *user,const char* r) } } clientlist.erase(iter); - delete user; + DELETE(user); } } @@ -587,7 +587,7 @@ void AddWhoWas(userrec* u) if (group->size() > 10) { WhoWasGroup *a = (WhoWasGroup*)*(group->begin()); - delete a; + DELETE(a); group->pop_front(); } @@ -607,7 +607,7 @@ void MaintainWhoWas(time_t TIME) while ((n->begin() != n->end()) && ((*n->begin())->signon < TIME - 259200)) // 3 days { WhoWasGroup *a = *(n->begin()); - delete a; + DELETE(a); n->erase(n->begin()); } } @@ -634,7 +634,7 @@ void AddClient(int socket, int port, bool iscached, in_addr ip4) if (iter != clientlist.end()) { userrec* goner = iter->second; - delete goner; + DELETE(goner); clientlist.erase(iter); } diff --git a/src/xline.cpp b/src/xline.cpp index 86a6081f2..0443a4f17 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -711,7 +711,7 @@ void apply_lines(const int What) } Goners->Apply(); - delete Goners; + DELETE(Goners); } void stats_k(userrec* user) |