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.

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib created this revision.Sep 13 2017, 10:30 AM
hselasky accepted this revision.Sep 13 2017, 10:39 AM
hselasky added inline comments.
lib/libc/net/getaddrinfo.c
38 ↗(On Diff #33009)

s/current/Current/

This revision is now accepted and ready to land.Sep 13 2017, 10:39 AM
kib updated this revision to Diff 33011.Sep 13 2017, 10:56 AM

Capitalize start of sentence.

This revision now requires review to proceed.Sep 13 2017, 10:56 AM
bjk added a subscriber: bjk.Sep 13 2017, 10:41 PM
bjk added inline comments.
lib/libc/net/getaddrinfo.3
364 ↗(On Diff #33011)

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).

kib updated this revision to Diff 33066.Sep 14 2017, 1:34 PM

bjk suggestion on the proper language.

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