From bacebef9af7acf3220bd829e13d062187985e317 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 1 Feb 2015 15:13:51 +0000 Subject: MSN: Minor leaks fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@11973 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn_natdetect.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'protocols/MSN/src/msn_natdetect.cpp') 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; -- cgit v1.2.3