freeaddrinfo(NULL)

JINMEI Tatuya /神明達哉 jinmei at isl.rdc.toshiba.co.jp
Tue Sep 21 15:37:19 PDT 2004


>>>>> On Tue, 21 Sep 2004 23:32:33 +0200, 
>>>>> Thomas Quinot <thomas at FreeBSD.ORG> said:

[...snip]

It seems that all these points simply show this is a controversial
issue.  I was not convinced with the argument for the no-op approach,
and still believe segfaulting is better.  But at the same time I seem
to have failed to convince others who believe in no-op.  So I won't
make further comments on those.  (If you feel this is unfair, please
raise the points again.)

One last comment about consistency:

>> This statement is too short to tell if it's valid, but I believe
>> Segfaulting on freeaddrinfo(NULL) can make something safer for the
>> reason I described above.  That is, catching a bug earlier *can*
>> make a safer result.

> In some conditions. But we have to take into account the fact that other
> systems do behave differently with a NULL pointer in freeaddrinfo (yes,
> I am specicly thinking of Linux and Windows), and we may also want to
> take *that* into account and find out how we can offer a consistent
> interface to programmers. I also believe that it would be friendlier to
> programmers to offer a behaviour more similar to free(3).

Note also that other *BSDs and Solaris use the "segfault" logic.  The
freeaddrinfo implementation in the "libbind" library as a part of the
ISC BIND package, which many UNIX-like OS vendors adopt (perhaps with
vendor-specific modifications though), also segfaults against a NULL
argument.

So, although consistency might in general be a good thing, the real
world's examples show we just have variations.

					JINMEI, Tatuya
					Communication Platform Lab.
					Corporate R&D Center, Toshiba Corp.
					jinmei at isl.rdc.toshiba.co.jp


More information about the freebsd-net mailing list