diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-01 15:13:51 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-01 15:13:51 +0000 |
commit | bacebef9af7acf3220bd829e13d062187985e317 (patch) | |
tree | 9dbf528ef0bfbe6c2dc76b6622d6948f19166ac7 /protocols/MSN/src/msn_natdetect.cpp | |
parent | 57a9a439a1fa94bc6c1d59230eae3a5360ff8272 (diff) |
MSN: Minor leaks fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@11973 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN/src/msn_natdetect.cpp')
-rw-r--r-- | protocols/MSN/src/msn_natdetect.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 76bcf7a081..60047bce40 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -91,8 +91,6 @@ static void DiscardExtraPackets(SOCKET s) void CMsnProto::MSNatDetect(void)
{
- unsigned i;
-
PHOSTENT host = gethostbyname("echo.edge.messenger.live.com");
if (host == NULL) {
debugLogA("P2PNAT could not find echo server \"echo.edge.messenger.live.com\"");
@@ -109,11 +107,12 @@ void CMsnProto::MSNatDetect(void) addr.sin_addr.S_un.S_un_b.s_b3, addr.sin_addr.S_un.S_un_b.s_b4);
SOCKET s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (connect(s, (SOCKADDR*)&addr, sizeof(addr)) == SOCKET_ERROR) {
+ debugLogA("P2PNAT could not connect to echo server \"echo.edge.messenger.live.com\"");
+ return;
+ }
- connect(s, (SOCKADDR*)&addr, sizeof(addr));
-
- UDPProbePkt pkt = { 0 };
- UDPProbePkt pkt2;
+ UDPProbePkt pkt = { 0 }, pkt2;
// Detect My IP
pkt.version = 2;
@@ -139,6 +138,7 @@ void CMsnProto::MSNatDetect(void) UDPProbePkt rpkt = { 0 };
// NAT detection
+ unsigned i;
for (i = 0; i < 4; ++i) {
if (Miranda_Terminated()) break;
|