diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-05-11 14:01:43 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-05-11 14:01:43 +0000 |
commit | 3ec0d26c76d6905501034692d05bddbabae64e76 (patch) | |
tree | 191efcdfd934a0369cdef723fe4f650fe2f3dcfc /sysdeps/posix | |
parent | 262cf6b3df91d5bb7cbdcae2390333b21e8008d5 (diff) |
Updated to fedora-glibc-20060511T1325cvs/fedora-glibc-2_4_90-7
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index fc0928676d..a78c670bfb 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1047,7 +1047,10 @@ gaih_inet (const char *name, const struct gaih_service *service, struct addrinfo *ai; ai = *pai = malloc (sizeof (struct addrinfo) + socklen); if (ai == NULL) - return -EAI_MEMORY; + { + free ((char *) canon); + return -EAI_MEMORY; + } ai->ai_flags = req->ai_flags; ai->ai_family = family; @@ -1065,6 +1068,10 @@ gaih_inet (const char *name, const struct gaih_service *service, #endif /* _HAVE_SA_LEN */ ai->ai_addr->sa_family = family; + /* In case of an allocation error the list must be NULL + terminated. */ + ai->ai_next = NULL; + if (family == AF_INET6) { struct sockaddr_in6 *sin6p = @@ -1088,7 +1095,6 @@ gaih_inet (const char *name, const struct gaih_service *service, pai = &(ai->ai_next); } - *pai = NULL; ++*naddrs; |