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 18:26:30 +0000
- Authentication-results: sfpop-ironport07.merit.edu; dkim=neutral (message not signed) header.i=none
Comment #2 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
Yes the goal is to get two lists of addrinfo's for v6 and v4. The v6 is then linked to v4 as a fallback so ndt falls back to only v4 (A v6 socket can do both v4 and v6).
In theory we can make these lists by setting ai_next and as long as every element ends up in a list and the tails get set to NULL we cannot possibly have a loop. But the library implementation of getaddrinfo returns a list of individually malloc()'d nodes. If the first element is a v4 address then only v4's will be linked after it and freeaddrinfo() would leak all the v6's. We could make sure we call freeaddrinfo() on the head of the v6 (which will have the v4's after it) but then freeaddrinfo() is being called with a different memory address which would fail in a library that implemented the getaddrinfo() list in a single contiguous piece of memory.
So I think we have to consider the list returned by getaddrinfo() read-only and avoid touching ai_next. Which is why I've needed use struct ai_node's to point to the actual addrinfo's.
--
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
- [ndt-dev] Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory, ndt, 04/13/2013
- [ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory, ndt, 04/15/2013
- [ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory, ndt, 04/15/2013
- [ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory, ndt, 04/19/2013
- [ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory, ndt, 04/21/2013
- [ndt-dev] Re: Issue 80 in ndt: Code Review - Fix for OpenSocket() causing a double free() of previously free()'d memory, ndt, 04/24/2013
Archive powered by MHonArc 2.6.16.