From fe59ae7a9effaff71d71d390014340472c60992b Mon Sep 17 00:00:00 2001 From: Connection Refused Date: Mon, 4 Oct 2021 18:47:17 +0800 Subject: [PATCH] [Redirector] Optimize code --- Redirector/DNSHandler.cpp | 2 +- Redirector/IPEventHandler.cpp | 2 +- Redirector/SocksHelper.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Redirector/DNSHandler.cpp b/Redirector/DNSHandler.cpp index ddb9ca71..bf86a3e8 100644 --- a/Redirector/DNSHandler.cpp +++ b/Redirector/DNSHandler.cpp @@ -74,7 +74,7 @@ bool DNSHandler::IsDNS(PSOCKADDR_IN6 target) void DNSHandler::CreateHandler(ENDPOINT_ID id, PSOCKADDR_IN6 target, const char* packet, int length, PNF_UDP_OPTIONS options) { SOCKADDR_IN6 remote; - auto buffer = new char[length](); + auto buffer = new char[length]; auto option = (PNF_UDP_OPTIONS)new char[sizeof(NF_UDP_OPTIONS) + options->optionsLength]; memcpy(&remote, target, sizeof(SOCKADDR_IN6)); diff --git a/Redirector/IPEventHandler.cpp b/Redirector/IPEventHandler.cpp index ea29a150..7d62ec5e 100644 --- a/Redirector/IPEventHandler.cpp +++ b/Redirector/IPEventHandler.cpp @@ -53,7 +53,7 @@ void ipSend(const char* buffer, int length, PNF_IP_PACKET_OPTIONS options) return; } - auto data = new BYTE[length](); + auto data = new BYTE[length]; memcpy(data, buffer, length); { diff --git a/Redirector/SocksHelper.cpp b/Redirector/SocksHelper.cpp index 73895e0b..ab9987e9 100644 --- a/Redirector/SocksHelper.cpp +++ b/Redirector/SocksHelper.cpp @@ -361,7 +361,7 @@ int SocksHelper::UDP::Send(PSOCKADDR_IN6 target, const char* buffer, int length) return SOCKET_ERROR; } - auto data = new char[3 + 1 + 16 + 2 + (ULONG64)length](); + auto data = new char[3 + 1 + 16 + 2 + (ULONG64)length]; data[3] = (target->sin6_family == AF_INET) ? 0x01 : 0x04; if (target->sin6_family == AF_INET)