Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » [SOLVED] Fix some memory leak in IpAddrInfo
[SOLVED] Fix some memory leak in IpAddrInfo [message #43169] Mon, 26 May 2014 05:45 Go to previous message
kasome is currently offline  kasome
Messages: 78
Registered: July 2008
Location: Taiwan
Member
In upp\uppsrc\Core\Socket.cpp

change

bool IpAddrInfo::Execute(const String& host, int port, int family)
{
	Clear();
	entry = exe;
	addrinfo *result;
	entry->addr = sGetAddrInfo(~host, ~AsString(port), family, &result) == 0 ? result : NULL;
	return entry->addr;
}


to

bool IpAddrInfo::Execute(const String& host, int port, int family)
{
	Clear();
	entry = exe;
	addrinfo *result;

	if(sGetAddrInfo(~host, ~AsString(port), family, &result) == 0 && result) {
		entry->addr = result;
		entry->status = RESOLVED;
	}
	else {
		entry->addr = NULL;
		entry->status = FAILED;
	}


	return entry->addr;
}

[Updated on: Mon, 28 July 2014 08:59]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: HttpRequest File Upload
Next Topic: MT and variables simple question
Goto Forum:
  


Current Time: Sun Apr 28 01:18:34 CEST 2024

Total time taken to generate the page: 1.00091 seconds