diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-13 17:25:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-13 17:25:52 +0000 |
commit | db58e3f45a11aa0b19c5d0638a20cc5d404f40a6 (patch) | |
tree | 79f6c34763f21a28260c0157f586c2fa7bc67dea /src/modules/netlib/netlibbind.cpp | |
parent | 01112f344f8e764043a306bc641876cf4c13db38 (diff) |
more code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@9789 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib/netlibbind.cpp')
-rw-r--r-- | src/modules/netlib/netlibbind.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp index 4d5e7b6ca8..00aef09049 100644 --- a/src/modules/netlib/netlibbind.cpp +++ b/src/modules/netlib/netlibbind.cpp @@ -243,6 +243,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) }
if (!foundPort) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "bind", WSAGetLastError());
+LBL_Error:
closesocket(nlbp->s);
closesocket(nlbp->s6);
mir_free(nlbp);
@@ -251,18 +252,12 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) if (nlbp->s != INVALID_SOCKET && listen(nlbp->s, 5)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "listen", WSAGetLastError());
- closesocket(nlbp->s);
- closesocket(nlbp->s6);
- mir_free(nlbp);
- return 0;
+ goto LBL_Error;
}
if (nlbp->s6 != INVALID_SOCKET && listen(nlbp->s6, 5)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "listen", WSAGetLastError());
- closesocket(nlbp->s);
- closesocket(nlbp->s6);
- mir_free(nlbp);
- return 0;
+ goto LBL_Error;
}
SOCKADDR_INET_M sinm = { 0 };
@@ -275,10 +270,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) nlb->wPort = ntohs(sinm.Ipv6.sin6_port);
else {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "getsockname", WSAGetLastError());
- closesocket(nlbp->s);
- closesocket(nlbp->s6);
- mir_free(nlbp);
- return 0;
+ goto LBL_Error;
}
nlbp->wPort = nlb->wPort;
|