about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-03-29 17:52:29 +0000
committerUlrich Drepper <drepper@redhat.com>2006-03-29 17:52:29 +0000
commit5b353be3b69fcea9b911fc1ef3980ed3f1a87d45 (patch)
treec9fda6138c2d61c15e6bdafd8696e748f05ec1af /sysdeps/posix
parentcd277b2d0342c17ae5e249039892058fc006ccc2 (diff)
downloadglibc-5b353be3b69fcea9b911fc1ef3980ed3f1a87d45.tar.gz
glibc-5b353be3b69fcea9b911fc1ef3980ed3f1a87d45.tar.xz
glibc-5b353be3b69fcea9b911fc1ef3980ed3f1a87d45.zip
* sysdeps/posix/getaddrinfo.c (gaih_inet): No need to duplicate
	'name' for 'canon'.  The final allocation will happen later.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 46c66a8f7e..37f7fa0bd2 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -538,16 +538,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  else
 	    return -EAI_ADDRFAMILY;
 
-	dupname:
 	  if (req->ai_flags & AI_CANONNAME)
-	    {
-	      canon = strdup (name);
-	      if (canon == NULL)
-		return -EAI_MEMORY;
-	    }
+	    canon = name;
 	}
-
-      if (at->family == AF_UNSPEC)
+      else if (at->family == AF_UNSPEC)
 	{
 	  char *namebuf = (char *) name;
 	  char *scope_delim = strchr (name, SCOPE_DELIMITER);
@@ -595,7 +589,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		    }
 		}
 
-	      goto dupname;
+	      if (req->ai_flags & AI_CANONNAME)
+		canon = name;
 	    }
 	}