git://git.novaco.in
/
novacoin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
4311474
)
prevent SOCKET leak in BindListenPort()
author
gades
<dmitriy@korniychuk.org.ua>
Sun, 23 Nov 2014 17:18:03 +0000 (19:18 +0200)
committer
0xDEADFACE
<masmfan@gmail.com>
Sun, 26 Apr 2015 18:55:15 +0000 (11:55 -0700)
Conflicts:
src/net.cpp
src/compat.h
patch
|
blob
|
history
src/net.cpp
patch
|
blob
|
history
diff --git
a/src/compat.h
b/src/compat.h
index
67fe63d
..
c38e2fa
100644
(file)
--- a/
src/compat.h
+++ b/
src/compat.h
@@
-70,5
+70,4
@@
inline int myclosesocket(SOCKET& hSocket)
}
#define closesocket(s) myclosesocket(s)
-
#endif
diff --git
a/src/net.cpp
b/src/net.cpp
index
698c4d4
..
ab079cf
100644
(file)
--- a/
src/net.cpp
+++ b/
src/net.cpp
@@
-1808,6
+1808,7
@@
bool BindListenPort(const CService &addrBind, string& strError)
else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %d, %s)"), addrBind.ToString().c_str(), nErr, strerror(nErr));
printf("%s\n", strError.c_str());
+ closesocket(hListenSocket);
return false;
}
printf("Bound to %s\n", addrBind.ToString().c_str());
@@
-1817,6
+1818,7
@@
bool BindListenPort(const CService &addrBind, string& strError)
{
strError = strprintf("Error: Listening for incoming connections failed (listen returned error %d)", WSAGetLastError());
printf("%s\n", strError.c_str());
+ closesocket(hListenSocket);
return false;
}