我这段代码居然存在内存泄漏??
我这段代码居然存在内存泄漏??
bool SendText(String TcpText){ bool Result = false; AnsiString TcpString = TcpText; if ( ! TcpString.IsEmpty() ) { __int64 SendSize = TcpString.Length(); AnsiString SendLength = IntToStr(SendSize); char* SendBuffer = new char[SendSize]; memcpy(SendBuffer, TcpString.c_str(), SendSize); sockaddr_in service; Result = ::sendto(SocketHandle, SendLength.c_str(), SendLength.Length()+1, 0, (struct sockaddr*)&service, sizeof(service)) >0 && ::sendto(SocketHandle, SendBuffer, SendSize, 0, (struct sockaddr*)&service, sizeof(service)) >0; delete [] SendBuffer; } return Result;}