Re: Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-01-15T12:43:03Z
Lists: pgsql-hackers
> On 13 Jan 2024, at 22:38, Ranier Vilela <ranier.vf@gmail.com> wrote:

> In the pgwin32_socket function (src/backend/port/win32/socket.c), there is a possible socket leak if the socket cannot be made non-blocking.

I don't know Windows well enough to comment on the implications of not calling
closesocket here, but it definitely seems like a prudent thing to do
backpatched down to 12. Unless objections I'll do that.

--
Daniel Gustafsson




Commits

  1. Close socket in case of errors in setting non-blocking