Fixed memory leak in LookupDNSAddr.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8451 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-14 21:19:08 +00:00
parent 87758c4043
commit e8b5ab9fae

View File

@ -847,7 +847,9 @@ bool LookupDNSAddr(std::string name, struct sockaddr_in &addr)
return false;
}
if ((res) && (res->ai_family == AF_INET))
if (res)
{
if (res->ai_family == AF_INET)
{
addr = *((struct sockaddr_in *) res->ai_addr);
freeaddrinfo(res);
@ -859,6 +861,8 @@ bool LookupDNSAddr(std::string name, struct sockaddr_in &addr)
#endif
return true;
}
freeaddrinfo(res);
}
#ifdef NET_DEBUG
std::cerr << "getaddrinfo failed - no address" << std::endl;