aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2014-07-17 22:33:58 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2014-07-17 22:49:23 +0200
commitc994d2e769239036626fe51c59daea4085fc3d54 (patch)
tree8f4504a9bdaf39f9333cfe3f62e42b69a5b7b5b6 /src
parente8d4cb807169dd56e8efc753521a94368dd2f69d (diff)
prevent SOCKET leak in BindListenPort()
- the call to CloseSocket() is placed after the WSAGetLastError(), because a CloseSocket() can trigger an error also, which we don't want for the logging in this two cases
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 441bde3e90..b55cd72e86 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1678,6 +1678,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr));
LogPrintf("%s\n", strError);
+ CloseSocket(hListenSocket);
return false;
}
LogPrintf("Bound to %s\n", addrBind.ToString());
@@ -1687,6 +1688,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
{
strError = strprintf(_("Error: Listening for incoming connections failed (listen returned error %s)"), NetworkErrorString(WSAGetLastError()));
LogPrintf("%s\n", strError);
+ CloseSocket(hListenSocket);
return false;
}