diff options
author | Dmitry Bilunov <kmeaw@kmeaw.com> | 2017-06-24 16:49:34 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-06-24 16:50:42 +0200 |
commit | 5cf88a83f27b0cd2d5a83511930e40d716c939eb (patch) | |
tree | 9c77735fa268ca633b8557ce497ee9c8f59d5d8f /sysdeps/posix/getaddrinfo.c | |
parent | 388b4f1a02f3a801965028bbfcd48d905638b797 (diff) | |
download | glibc-5cf88a83f27b0cd2d5a83511930e40d716c939eb.tar glibc-5cf88a83f27b0cd2d5a83511930e40d716c939eb.tar.gz glibc-5cf88a83f27b0cd2d5a83511930e40d716c939eb.tar.bz2 glibc-5cf88a83f27b0cd2d5a83511930e40d716c939eb.zip |
getaddrinfo: Merge IPv6 addresses and IPv4 addresses [BZ #21295]
Diffstat (limited to 'sysdeps/posix/getaddrinfo.c')
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 4ec17961ad..91e0a76c5c 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -190,16 +190,16 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp, /* Convert struct hostent to a list of struct gaih_addrtuple objects. h_name is not copied, and the struct hostent object must not be - deallocated prematurely. *RESULT must be NULL or a pointer to an - object allocated using malloc, which is freed. */ + deallocated prematurely. *RESULT must be NULL or a pointer to a + linked-list. The new addresses are appended at the end. */ static bool convert_hostent_to_gaih_addrtuple (const struct addrinfo *req, int family, struct hostent *h, struct gaih_addrtuple **result) { - free (*result); - *result = NULL; + while (*result) + result = &(*result)->next; /* Count the number of addresses in h->h_addr_list. */ size_t count = 0; |