Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory

Subject: NDT-DEV email list created

List archive

[ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory
  • Date: Mon, 15 Apr 2013 15:46:26 +0000
  • Authentication-results: sfpop-ironport03.merit.edu; dkim=neutral (message not signed) header.i=none


Comment #1 on issue 80 by : Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory
http://code.google.com/p/ndt/issues/detail?id=80

The code is rather confusing. Is the goal to get two list of addrinfo's, the v6 addresses, and the v4 addresses? If so, why can't you create two lists, one v4 and one v6, doing something like:

addrinfo *ipv4_list = NULL;
addrinfo *ipv6_list = NULL;
ai = fai;
while (ai != NULL) {
addrinfo *next = ai->ai_next;

if (ai->ai_family == AF_INET) {
ai->ai_next = ipv4_list;
ipv4_list = ai;
}
// add similar for AF_INET6

ai = next;
}

To get the sorted list of all v4 and v6 addresses, you just track the tail of the v6 linked list, and set its ai_next pointer to the v4 list.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings



Archive powered by MHonArc 2.6.16.

Top of Page