use strdup().

Obtained from:	KAME
MFC after:	1 week
This commit is contained in:
Hajimu UMEMOTO 2005-01-28 19:35:42 +00:00
parent bd8d684fd7
commit 8743b270c9

View File

@ -1331,10 +1331,9 @@ get_canonname(pai, ai, str)
const char *str;
{
if ((pai->ai_flags & AI_CANONNAME) != 0) {
ai->ai_canonname = (char *)malloc(strlen(str) + 1);
ai->ai_canonname = strdup(str);
if (ai->ai_canonname == NULL)
return EAI_MEMORY;
strlcpy(ai->ai_canonname, str, strlen(str) + 1);
}
return 0;
}