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)
Nov 3 2024, 5:04 PM
Unknown Object (File)
Nov 3 2024, 5:04 PM
Unknown Object (File)
Nov 3 2024, 5:04 PM
Unknown Object (File)
Nov 3 2024, 5:03 PM
Unknown Object (File)
Nov 3 2024, 5:03 PM
Unknown Object (File)
Nov 3 2024, 4:43 PM
Unknown Object (File)
Oct 3 2024, 5:00 AM
Unknown Object (File)
Oct 1 2024, 2:14 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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

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.