use strdup().
Obtained from: KAME MFC after: 1 week
This commit is contained in:
parent
d08c8a1c03
commit
04b2845059
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user