This is an automated email from the ASF dual-hosted git repository.

leborchuk pushed a commit to branch REL_2_STABLE
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit f19c2832221a2453a4f3bbd40b8023dbefbfa362
Author: Daniel Gustafsson <[email protected]>
AuthorDate: Wed Jan 17 11:24:11 2024 +0100

    Close socket in case of errors in setting non-blocking
    
    If configuring the newly created socket non-blocking fails we
    error out and return INVALID_SOCKET, but the socket that had
    been created wasn't closed. Fix by issuing closesocket in the
    errorpath.
    
    Backpatch to all supported branches.
    
    Author: Ranier Vilela <[email protected]>
    Discussion: 
https://postgr.es/m/CAEudQApmU5CrKefH85VbNYE2y8H=-qqejbg6rapu65+vce+...@mail.gmail.com
    Backpatch-through: v12
    (cherry picked from commit d8f6ab5f66a3fcce61694308172ffd6c9e04d6b2)
---
 src/backend/port/win32/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c
index af151e84709..4dd57440cac 100644
--- a/src/backend/port/win32/socket.c
+++ b/src/backend/port/win32/socket.c
@@ -298,6 +298,7 @@ pgwin32_socket(int af, int type, int protocol)
        if (ioctlsocket(s, FIONBIO, &on))
        {
                TranslateSocketError();
+               closesocket(s);
                return INVALID_SOCKET;
        }
        errno = 0;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to