On Fri, Jan 16, 2015 at 03:06:49PM +0100, marcus overhagen wrote: > > + current->ifa_data = interface; > > + current->ifa_name = interface->Name(); > > + // Points to the name in the > > BNetworkInterface instance, which > > + // is added as ifa_data so freeifaddrs can > > release it. > probably better to strdup() the name once, then you don't need to keep > the interface around. > > > > + delete interface; > Is it really required to create all those interface instances, can't > you use a single one on the stack? The idea is to make them available to the getifaddrs caller through the ifa_data field. If we don't want to do that, then yes, it can be allocated on the stack and the name copied. -- Adrien.