From 24bc0b067b579cd7da68381d208a824bf5a79f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 17 Sep 2023 17:23:58 +0200 Subject: [PATCH] Don't leak the sockets that won't connect --- Common/Net/HTTPClient.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index 449251100b..9563127461 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -121,6 +121,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { if (connect(sock, possible->ai_addr, (int)possible->ai_addrlen) < 0) { if (errno != EINPROGRESS) { ERROR_LOG(HTTP, "connect(%d) call failed (%d: %s)", sock, errno, strerror(errno)); + closesocket(sock); continue; } }