Merge pull request #4551

c994d2e prevent SOCKET leak in BindListenPort() (Philip Kaufmann)
This commit is contained in:
Wladimir J. van der Laan 2014-07-18 10:45:42 +02:00
commit d3cb2b8acf
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6

View File

@ -1678,6 +1678,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
else else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr)); strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr));
LogPrintf("%s\n", strError); LogPrintf("%s\n", strError);
CloseSocket(hListenSocket);
return false; return false;
} }
LogPrintf("Bound to %s\n", addrBind.ToString()); 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())); strError = strprintf(_("Error: Listening for incoming connections failed (listen returned error %s)"), NetworkErrorString(WSAGetLastError()));
LogPrintf("%s\n", strError); LogPrintf("%s\n", strError);
CloseSocket(hListenSocket);
return false; return false;
} }