use strdup().

Obtained from:	KAME
MFC after:	1 week
This commit is contained in:
ume 2005-01-28 19:35:42 +00:00
parent d08c8a1c03
commit 04b2845059

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;
}