Commit b6640ad0 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Fixed memory leaks in socket implementation.

Fixed memory leaks reported by valgring in the socket implementation and socket tests.

BUG=276
Review URL: http://codereview.chromium.org/42331

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1536 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b226f124
......@@ -735,6 +735,7 @@ bool FreeBSDSocket::Connect(const char* host, const char* port) {
// Connect.
status = connect(socket_, result->ai_addr, result->ai_addrlen);
freeaddrinfo(result);
return status == 0;
}
......
......@@ -736,6 +736,7 @@ bool LinuxSocket::Connect(const char* host, const char* port) {
// Connect.
status = connect(socket_, result->ai_addr, result->ai_addrlen);
freeaddrinfo(result);
return status == 0;
}
......
......@@ -667,6 +667,7 @@ bool MacOSSocket::Connect(const char* host, const char* port) {
// Connect.
status = connect(socket_, result->ai_addr, result->ai_addrlen);
freeaddrinfo(result);
return status == 0;
}
......
......@@ -1634,6 +1634,7 @@ bool Win32Socket::Connect(const char* host, const char* port) {
// Connect.
status = connect(socket_, result->ai_addr, result->ai_addrlen);
freeaddrinfo(result);
return status == 0;
}
......
......@@ -22,6 +22,8 @@ class SocketListenerThread : public Thread {
// Close both sockets.
delete client_;
delete server_;
delete listening_;
delete[] data_;
}
void Run();
......@@ -128,6 +130,7 @@ TEST(Socket) {
medium_data[i] = i % 256;
}
SendAndReceive(medium_data, kBufferSizeMedium);
delete[] medium_data;
// Send and receive even more data.
static const int kBufferSizeLarge = 1000000;
......@@ -136,6 +139,7 @@ TEST(Socket) {
large_data[i] = i % 256;
}
SendAndReceive(large_data, kBufferSizeLarge);
delete[] large_data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment