[PATCH v2] xmalloc: Fix warnings with gcc analyzer
Florian Weimer
fweimer@redhat.com
Wed Jul 28 11:25:16 GMT 2021
* Siddhesh Poyarekar:
> On 7/28/21 4:44 PM, Florian Weimer via Libc-alpha wrote:
>> * Siddhesh Poyarekar:
>>
>>> extern void *xrealloc (void *o, size_t n)
>>> + __attribute_malloc__ __attribute_alloc_size__ ((2)) __attr_dealloc_free
>>> + __returns_nonnull;
>> Sorry, this one has again __returns_nonnull for xrealloc.
>
> The xrealloc in programs does a malloc(1) if the size requested is 0,
> so it never really returns a NULL.
So it does not free anything ever?
We should not have two different attributes for xrealloc. I suggest to
drop the attribute from the include/* version for now, until we can
clean this up.
Thanks,
Florian
More information about the Libc-alpha
mailing list