On 2/18/19 12:00 PM, Chuck Lever wrote: >> I also took a look at how freeaddrinfo(3) in glibc works: >> >> void >> freeaddrinfo (struct addrinfo *ai) >> { >> struct addrinfo *p; >> >> while (ai != NULL) >> { >> p = ai; >> ai = ai->ai_next; >> free (p->ai_canonname); >> free (p); >> } >> } >> It makes the assumption that ai_canonname is >> free-able memory.... > Right, I seem to recall looking at this implementation when > I wrote the IPv6 support for nfs-utils. That seems sensible > to me. > > However Peter's point is not all C libraries have to work > that way, and I can see that argument too. I agreed.... > > I have no objection to taking his fix as long as the hunk > in host_numeric_addrinfo() is dropped while we figure out > a more complete fix for that issue. Taking it out I can see us getting flagged for possible memory leaking.... Taking a look to why those frees were add... see commit 94ce1eb9 They should look very familiar to you ;-) > I would also like to > see his fix use a helper like nfs_freeaddrinfo(), but that > is only a suggestion. That is a good suggestion... It definitely cleans up the code. steved. > >