summaryrefslogtreecommitdiff
path: root/gethost.c
diff options
context:
space:
mode:
Diffstat (limited to 'gethost.c')
-rw-r--r--gethost.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gethost.c b/gethost.c
index a0f30da..94c1d99 100644
--- a/gethost.c
+++ b/gethost.c
@@ -307,7 +307,15 @@ struct addrlist *get_address_info (
family = FamilyInternet6;
}
- if (len > 0 && src != NULL) {
+ struct addrlist *duplicate;
+ for(duplicate = retval; duplicate != NULL; duplicate = duplicate->next) {
+ if(duplicate->family == family && duplicate->len == len &&
+ memcmp(duplicate->address, src, len) == 0) {
+ break;
+ }
+ }
+
+ if (len > 0 && src != NULL && duplicate == NULL) {
struct addrlist *newrv = malloc (sizeof(struct addrlist));
if (newrv) {
newrv->address = malloc (len);