Permalink
Browse files

Correct some proxy related socket leaks.

  • Loading branch information...
Tranz5 committed Jul 15, 2014
1 parent 32de299 commit e2a25efe480b720e85bf19da72aa539f52b1abe3
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/netbase.cpp
View
@@ -296,8 +296,10 @@ bool static Socks5(string strDest, int port, SOCKET& hSocket)
case 0x03:
{
ret = recv(hSocket, pchRet3, 1, 0) != 1;
if (ret)
if (ret) {
closesocket(hSocket);
return error("Error reading from proxy");
}
int nRecv = pchRet3[0];
ret = recv(hSocket, pchRet3, nRecv, 0) != nRecv;
break;
@@ -504,6 +506,7 @@ bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout)
return false;
break;
default:
closesocket(hSocket);
return false;
}
@@ -535,7 +538,9 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest
switch(nameproxy.second) {
default:
case 4: return false;
case 4:
closesocket(hSocket);
return false;
case 5:
if (!Socks5(strDest, port, hSocket))
return false;

0 comments on commit e2a25ef

Please sign in to comment.