https://bugs.winehq.org/show_bug.cgi?id=38399
--- Comment #5 from Bruno Jesus 00cpxxx@gmail.com --- (In reply to Sebastian Lackner from comment #4)
The patch is not completely correct, you are passing a wrong file descriptor to the first release_sock_fd() call (should be "fd" instead of "fds[j].fd"). Moreover I think it would be better to add a check to avoid calling release_sock_fd() with -1 (the rest of the code also checks this).
You are right, classic copy & paste issues that happen when you are still typing code after 1am ;-)