From af545fafa6ab3bf7a4f91cc73e97df4db15930c1 Mon Sep 17 00:00:00 2001 From: itojun <> Date: Fri, 28 Jan 2000 17:47:26 +0000 Subject: 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). --- src/lib/libc/net/freeaddrinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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) { struct addrinfo *p; - while (ai) { + do { p = ai; ai = ai->ai_next; if (p->ai_canonname) free(p->ai_canonname); free((void *)p); - } + } while (ai); } -- cgit v1.2.3-55-g6feb