Fix leaked sockets when failing to check for updates

git-svn-id: https://svn.eduke32.com/eduke32@7028 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-10-07 05:22:22 +00:00
parent eb08f1443e
commit c67cdc00f8

View file

@ -81,6 +81,7 @@ int32_t G_GetVersionFromWebsite(char *buffer)
if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR)
{ {
// initprintf("update: connect() error in G_GetVersionFromWebsite() (%d)\n",errno); // initprintf("update: connect() error in G_GetVersionFromWebsite() (%d)\n",errno);
closesocket(mysock);
return 0; return 0;
} }
@ -88,6 +89,7 @@ int32_t G_GetVersionFromWebsite(char *buffer)
if (bytes_sent == SOCKET_ERROR) if (bytes_sent == SOCKET_ERROR)
{ {
// initprintf("update: send() error in G_GetVersionFromWebsite() (%d)\n",errno); // initprintf("update: send() error in G_GetVersionFromWebsite() (%d)\n",errno);
closesocket(mysock);
return 0; return 0;
} }
@ -96,6 +98,7 @@ int32_t G_GetVersionFromWebsite(char *buffer)
if (i < 0) if (i < 0)
{ {
// initprintf("update: recv() returned %d\n", i); // initprintf("update: recv() returned %d\n", i);
closesocket(mysock);
return 0; return 0;
} }