diff --git a/r5dev/engine/client/cl_rcon.h b/r5dev/engine/client/cl_rcon.h index ac317c14..74696dba 100644 --- a/r5dev/engine/client/cl_rcon.h +++ b/r5dev/engine/client/cl_rcon.h @@ -8,7 +8,7 @@ class CRConClient { public: CRConClient(void){}; - ~CRConClient(void){}; + ~CRConClient(void) { delete m_pNetAdr2; delete m_pSocket; }; void Init(void); void Shutdown(void); diff --git a/r5dev/engine/server/sv_rcon.cpp b/r5dev/engine/server/sv_rcon.cpp index 970e497d..d6bee682 100644 --- a/r5dev/engine/server/sv_rcon.cpp +++ b/r5dev/engine/server/sv_rcon.cpp @@ -31,7 +31,7 @@ void CRConServer::Init(void) return; } - m_pAdr2 = new CNetAdr2(rcon_address->GetString(), hostport->GetString()); + m_pAdr2->SetIPAndPort(rcon_address->GetString(), hostport->GetString()); m_pSocket->CreateListenSocket(*m_pAdr2, false); m_svPasswordHash = sha256(rcon_password->GetString()); @@ -453,7 +453,6 @@ void CRConServer::CloseConnection(void) // NETMGR void CRConServer::CloseNonAuthConnection(void) { int nCount = m_pSocket->GetAcceptedSocketCount(); - for (int i = nCount - 1; i >= 0; i--) { CConnectedNetConsoleData* pData = m_pSocket->GetAcceptedSocketData(i); diff --git a/r5dev/engine/server/sv_rcon.h b/r5dev/engine/server/sv_rcon.h index b1adf930..c9edc712 100644 --- a/r5dev/engine/server/sv_rcon.h +++ b/r5dev/engine/server/sv_rcon.h @@ -12,6 +12,8 @@ constexpr char s_pszAuthMessage[] = "RCON authentication succesfull.\n\r"; class CRConServer { public: + ~CRConServer() { delete m_pAdr2; delete m_pSocket; } + void Init(void); void Shutdown(void); diff --git a/r5dev/netconsole/netconsole.h b/r5dev/netconsole/netconsole.h index 08f48621..27ed534d 100644 --- a/r5dev/netconsole/netconsole.h +++ b/r5dev/netconsole/netconsole.h @@ -12,6 +12,8 @@ constexpr const char* NETCON_VERSION = "2.0.0.1"; class CNetCon { public: + ~CNetCon() { delete m_pNetAdr2; delete m_pSocket; } + bool Init(void); bool Shutdown(void); diff --git a/r5dev/squirrel/sqscript.cpp b/r5dev/squirrel/sqscript.cpp index 88bd65be..7549b0e0 100644 --- a/r5dev/squirrel/sqscript.cpp +++ b/r5dev/squirrel/sqscript.cpp @@ -30,7 +30,10 @@ SQRESULT Script_RegisterFunction(CSquirrelVM* pSquirrelVM, const SQChar* szScrip sqFunc->m_szArgTypes = szArgTypes; sqFunc->m_pFunction = pFunction; - return v_Script_RegisterFunction(pSquirrelVM, sqFunc, 1); + SQRESULT results = v_Script_RegisterFunction(pSquirrelVM, sqFunc, 1); + delete sqFunc; + + return results; } #ifndef CLIENT_DLL diff --git a/r5dev/tier1/NetAdr2.cpp b/r5dev/tier1/NetAdr2.cpp index 1712a829..00a6618b 100644 --- a/r5dev/tier1/NetAdr2.cpp +++ b/r5dev/tier1/NetAdr2.cpp @@ -26,32 +26,7 @@ CNetAdr2::CNetAdr2(string svInAdr) //----------------------------------------------------------------------------- CNetAdr2::CNetAdr2(string svInAdr, string svInPort) { - SetType(netadrtype_t::NA_IP); - - if (strcmp(svInAdr.c_str(), "loopback") == 0 || strcmp(svInAdr.c_str(), "::1") == 0) - { - SetType(netadrtype_t::NA_LOOPBACK); - } - else if (strcmp(svInAdr.c_str(), "localhost") == 0) - { - svInAdr = "127.0.0.1"; - } - - if (strstr(svInAdr.c_str(), "[") || strstr(svInAdr.c_str(), "]")) - { - svInAdr = GetBase(svInAdr); - } - SetIPAndPort(svInAdr, svInPort); - - if (m_version == netadrversion_t::NA_V4) - { - reinterpret_cast<sockaddr_in*>(&m_sadr)->sin_port = htons(stoi(GetPort())); - } - else if (m_version == netadrversion_t::NA_V6) - { - reinterpret_cast<sockaddr_in6*>(&m_sadr)->sin6_port = htons(stoi(GetPort())); - } } //----------------------------------------------------------------------------- @@ -118,7 +93,6 @@ void CNetAdr2::SetIPAndPort(string svInAdr) void CNetAdr2::SetIPAndPort(string svInAdr, string svInPort) { SetType(netadrtype_t::NA_IP); - if (strcmp(svInAdr.c_str(), "loopback") == 0 || strcmp(svInAdr.c_str(), "::1") == 0) { SetType(netadrtype_t::NA_LOOPBACK);