Skip to content

Commit 7cfa154

Browse files
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 <ranier.vf@gmail.com> Discussion: https://postgr.es/m/CAEudQApmU5CrKefH85VbNYE2y8H=-qqEJbg6RAPU65+vCe+89A@mail.gmail.com Backpatch-through: v12
1 parent 44ad512 commit 7cfa154

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/backend/port/win32/socket.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ pgwin32_socket(int af, int type, int protocol)
303303
if (ioctlsocket(s, FIONBIO, &on))
304304
{
305305
TranslateSocketError();
306+
closesocket(s);
306307
return INVALID_SOCKET;
307308
}
308309
errno = 0;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy