[krbdev.mit.edu #6534] getaddrinfo in src/util/support/fake-addrinfo.c causes leak

Greg Hudson via RT rt-comment at krbdev.mit.edu
Wed Aug 26 14:54:27 EDT 2009


Thanks for the report and proposed fix.

I have an idea for fixing the problem more robustly.  I don't have any
better ideas than yours on how to detect whether we need the workaround,
but when we do apply the workaround, we shouldn't need to make
assumptions about whether the system getaddrinfo() allocated
ai_canonname or not.  What we should do instead is:

1. Store the system getaddrinfo result in a temporary.
2. Construct our own copy of the result, allocated with our own code,
containing the modified ai_canonname fields.
3. Free the system getaddrinfo result with the system freeaddrinfo.
4. When our freeaddrinfo wrapper is called, use our own code to free the
addrinfo structure, which we know was constructed with our own code.

I will likely apply your patch in addition so that we aren't doing
unnecessary extra work on modern Linux systems.



More information about the krb5-bugs mailing list