Page MenuHomeFreeBSD

Silently handle freeaddrinfo(NULL) for compatibility with code which works on other OSes.
ClosedPublic

Authored by kib on Sep 13 2017, 10:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 18, 11:30 PM
Unknown Object (File)
Sat, Mar 16, 5:14 AM
Unknown Object (File)
Thu, Mar 7, 11:32 PM
Unknown Object (File)
Dec 23 2023, 4:16 AM
Unknown Object (File)
Nov 7 2023, 10:56 AM
Unknown Object (File)
Nov 6 2023, 10:40 PM
Unknown Object (File)
Oct 6 2023, 9:53 AM
Unknown Object (File)
Oct 5 2023, 9:34 PM

Details

Summary

Also avoid unnecessary NULL check, free(NULL) is valid.

I did read https://lists.freebsd.org/pipermail/freebsd-net/2004-September/005065.html. But Linux accepts NULL and more and more code just expects this to work. It costs nothing to us, while removing another trip over the porting.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

hselasky added inline comments.
lib/libc/net/getaddrinfo.c
38

s/current/Current/

This revision is now accepted and ready to land.Sep 13 2017, 10:39 AM

Capitalize start of sentence.

This revision now requires review to proceed.Sep 13 2017, 10:56 AM
bjk added inline comments.
lib/libc/net/getaddrinfo.3
364

I would suggest something like:
The behavior of
.Li freeadrinfo(NULL)
is left unspecified by both
.St -susv4
and
.Dv "RFC 3493" .
The current implementation ignores a
.Dv NULL
argument for compatibility with programs that rely on the implementation
details of other operating systems.

A potential alternative to ".Li freeaddrinfo(NULL)" is "a .Dv NULL argument to .Nm" (with appropriate newlines).

bjk suggestion on the proper language.

kib marked an inline comment as done.Sep 14 2017, 1:35 PM
This revision is now accepted and ready to land.Sep 14 2017, 5:17 PM
This revision was automatically updated to reflect the committed changes.