This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nscd: Deallocate existing user names in file parser
- From: Carlos O'Donell <carlos at redhat dot com>
- To: DJ Delorie <dj at redhat dot com>, Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 13 Aug 2018 14:45:39 -0400
- Subject: Re: [PATCH] nscd: Deallocate existing user names in file parser
- References: <xnsh3ii0bc.fsf@greed.delorie.com>
On 08/13/2018 02:33 PM, DJ Delorie wrote:
>
> fweimer@redhat.com (Florian Weimer) writes:
>> - server_user = xstrdup (arg1);
>> + {
>> + free ((char *) server_user);
>> + server_user = xstrdup (arg1);
>> + }
>
> server_user is global and unitialized, so initialized to NULL. free()
> allows the passed pointer to be NULL. So this is OK.
>
> Note that free() nominally takes a void*, not a char*. I think we
> should use void* in this case.
>
>> {
>> + free ((char *) stat_user);
>> stat_user = xstrdup (arg1);
>
> Same here.
>
Does this mean you think the patch is OK as is?
Please remember to be clear about this.
My recommendation is to use "Reviewed-by: DJ Delorie <dj@redhat.com>" at the
end of your reviews to make the review clear.
--
Cheers,
Carlos.