diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-11 16:50:04 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-11 16:50:04 +0000 |
commit | 78cee590285371ff574a957801024bcb6e75040f (patch) | |
tree | 530d61d57234b7d5816ffe32bf138251b20ab54d /src/modules/netlib | |
parent | a8e0f6b67fdfb0e8fcc7fe0394e78198501025bc (diff) |
Core: Fixed minor memory leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@11830 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib')
-rw-r--r-- | src/modules/netlib/netlibopenconn.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 45adb2c88b..c7daa9dea2 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -496,15 +496,15 @@ retry: return rc == 0; } -static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) +static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) { + if (!nloc) + return false; + int rc = SOCKET_ERROR, retrycnt = 0; u_long notblocking = 1; DWORD lasterr = 0; static const TIMEVAL tv = { 1, 0 }; - - if (!nloc) - return false; unsigned int dwTimeout = (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2) ? nloc->timeout : 0; // if dwTimeout is zero then its an old style connection or new with a 0 timeout, select() will error quicker anyway if (dwTimeout == 0) dwTimeout = 30; @@ -565,12 +565,16 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, ptrA(NetlibAddressToString((SOCKADDR_INET_M*)ai->ai_addr))); retry: nlc->s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); - if (nlc->s == INVALID_SOCKET) + if (nlc->s == INVALID_SOCKET) { + FreeAddrInfoA(air); return false; + } // return the socket to non blocking - if (ioctlsocket(nlc->s, FIONBIO, ¬blocking) != 0) + if (ioctlsocket(nlc->s, FIONBIO, ¬blocking) != 0) { + FreeAddrInfoA(air); return false; + } if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0]) { SOCKET s = ai->ai_family == AF_INET ? nlc->s : INVALID_SOCKET; @@ -657,7 +661,7 @@ retry: return rc == 0; } -static bool my_connect(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) +static bool my_connect(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) { return my_connectIPv6(nlc, nloc); } |