From c67cdc00f8ee8da4cfa14e7c41146e7a906cf226 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 7 Oct 2018 05:22:22 +0000 Subject: [PATCH] Fix leaked sockets when failing to check for updates git-svn-id: https://svn.eduke32.com/eduke32@7028 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/winbits.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/duke3d/src/winbits.cpp b/source/duke3d/src/winbits.cpp index 871498e55..8b3e8147e 100644 --- a/source/duke3d/src/winbits.cpp +++ b/source/duke3d/src/winbits.cpp @@ -81,6 +81,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) { // initprintf("update: connect() error in G_GetVersionFromWebsite() (%d)\n",errno); + closesocket(mysock); return 0; } @@ -88,6 +89,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) if (bytes_sent == SOCKET_ERROR) { // initprintf("update: send() error in G_GetVersionFromWebsite() (%d)\n",errno); + closesocket(mysock); return 0; } @@ -96,6 +98,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) if (i < 0) { // initprintf("update: recv() returned %d\n", i); + closesocket(mysock); return 0; }