diff options
author | itojun <> | 2000-01-28 17:47:26 +0000 |
---|---|---|
committer | itojun <> | 2000-01-28 17:47:26 +0000 |
commit | af545fafa6ab3bf7a4f91cc73e97df4db15930c1 (patch) | |
tree | 62f2160333a3c37b34f0e9dc3bf97fbb731d5bd2 | |
parent | 5b1f731bf4378d5cde8894a5aa27c652e69e5a5f (diff) | |
download | openbsd-af545fafa6ab3bf7a4f91cc73e97df4db15930c1.tar.gz openbsd-af545fafa6ab3bf7a4f91cc73e97df4db15930c1.tar.bz2 openbsd-af545fafa6ab3bf7a4f91cc73e97df4db15930c1.zip |
don't permit freeaddrinfo(NULL). now the behavior is consistent
across {free,net,open}bsd.
both rfc2553 and X/Open spec are silent about the behavior,
and there's no strong consensus either. i think library should NOT be
forgiving in this case, to promote development of more robust 3rd-party
codebase (code works on "freeaddrinfo(NULL) = SEGV" will work on
"freeaddrinfo(NULL) is okay" environment, but not the other way around).
only issue i have now is NRL freeaddrinfo() compatibility, which permits
freeaddrinfo(NULL).
-rw-r--r-- | src/lib/libc/net/freeaddrinfo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/net/freeaddrinfo.c b/src/lib/libc/net/freeaddrinfo.c index 40534f4422..30fbecb805 100644 --- a/src/lib/libc/net/freeaddrinfo.c +++ b/src/lib/libc/net/freeaddrinfo.c | |||
@@ -39,11 +39,11 @@ freeaddrinfo(ai) | |||
39 | { | 39 | { |
40 | struct addrinfo *p; | 40 | struct addrinfo *p; |
41 | 41 | ||
42 | while (ai) { | 42 | do { |
43 | p = ai; | 43 | p = ai; |
44 | ai = ai->ai_next; | 44 | ai = ai->ai_next; |
45 | if (p->ai_canonname) | 45 | if (p->ai_canonname) |
46 | free(p->ai_canonname); | 46 | free(p->ai_canonname); |
47 | free((void *)p); | 47 | free((void *)p); |
48 | } | 48 | } while (ai); |
49 | } | 49 | } |