Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+1
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)