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 next 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

Re: Fix some memory leak in IpAddrInfo [message #43183 is a reply to message #43169] Fri, 30 May 2014 08:23 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ops, thanks!

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


Current Time: Thu Mar 28 10:05:08 CET 2024

Total time taken to generate the page: 0.01071 seconds