mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
87758c4043
commit
e8b5ab9fae
@ -847,17 +847,21 @@ bool LookupDNSAddr(std::string name, struct sockaddr_in &addr)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res) && (res->ai_family == AF_INET))
|
if (res)
|
||||||
{
|
{
|
||||||
addr = *((struct sockaddr_in *) res->ai_addr);
|
if (res->ai_family == AF_INET)
|
||||||
freeaddrinfo(res);
|
{
|
||||||
|
addr = *((struct sockaddr_in *) res->ai_addr);
|
||||||
|
freeaddrinfo(res);
|
||||||
|
|
||||||
#ifdef NET_DEBUG
|
#ifdef NET_DEBUG
|
||||||
std::cerr << "LookupDNSAddr() getaddrinfo found address" << std::endl;
|
std::cerr << "LookupDNSAddr() getaddrinfo found address" << std::endl;
|
||||||
std::cerr << "addr: " << rs_inet_ntoa(addr.sin_addr) << std::endl;
|
std::cerr << "addr: " << rs_inet_ntoa(addr.sin_addr) << std::endl;
|
||||||
std::cerr << "port: " << ntohs(addr.sin_port) << std::endl;
|
std::cerr << "port: " << ntohs(addr.sin_port) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
freeaddrinfo(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NET_DEBUG
|
#ifdef NET_DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user