trawick 01/08/01 11:03:33 Modified: network_io/unix sa_common.c Log: free the whole list of addrinfo structures returned by getaddrinfo() Revision Changes Path 1.42 +4 -3 apr/network_io/unix/sa_common.c Index: sa_common.c =================================================================== RCS file: /home/cvs/apr/network_io/unix/sa_common.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- sa_common.c 2001/07/31 05:59:36 1.41 +++ sa_common.c 2001/08/01 18:03:33 1.42 @@ -338,7 +338,7 @@ #if defined(HAVE_GETADDRINFO) if (hostname != NULL) { - struct addrinfo hints, *ai; + struct addrinfo hints, *ai, *ai_list; apr_sockaddr_t *cursa; int error; char num[8]; @@ -349,7 +349,7 @@ hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; apr_snprintf(num, sizeof(num), "%d", port); - error = getaddrinfo(hostname, num, &hints, &ai); + error = getaddrinfo(hostname, num, &hints, &ai_list); if (error) { if (error == EAI_SYSTEM) { return errno; @@ -366,6 +366,7 @@ } } cursa = *sa; + ai = ai_list; save_addrinfo(p, cursa, ai, port); while (ai->ai_next) { /* while more addresses to report */ cursa->next = apr_pcalloc(p, sizeof(apr_sockaddr_t)); @@ -373,7 +374,7 @@ cursa = cursa->next; save_addrinfo(p, cursa, ai, port); } - freeaddrinfo(ai); + freeaddrinfo(ai_list); } else { if (family == APR_UNSPEC) {