Re: [PATCH] Workaround for ai_canonname sometimes coming back as null
2009/4/29 Alex Riesen <raa.lkml@gmail.com>:
Show 15 quoted lines
> 2009/4/29 Augie Fackler <durin42@gmail.com>:
>> @@ -459,7 +459,10 @@ static void parse_extra_args(char *extra_args, int
>> buflen)
>> inet_ntop(AF_INET, &sin_addr->sin_addr,
>> addrbuf, sizeof(addrbuf));
>> free(canon_hostname);
>> - canon_hostname = xstrdup(ai->ai_canonname);
>> + if (ai->ai_canonname)
>> + canon_hostname =
>> xstrdup(ai->ai_canonname);
>> + else
>> + canon_hostname = "unknown";
>
> This last line will crash some lines down, when canon_hostname is free'd:
>
Actually, it will crash in the line just above. On the same reasons.