(gaih_inet): No need to duplicate 'name' for 'canon'. The final
authordrepper <drepper>
Wed, 29 Mar 2006 17:49:24 +0000 (17:49 +0000)
committerdrepper <drepper>
Wed, 29 Mar 2006 17:49:24 +0000 (17:49 +0000)
allocation will happen later.

sysdeps/posix/getaddrinfo.c

index 46c66a8..37f7fa0 100644 (file)
@@ -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;
            }
        }