[PATCH 24/28] elf: Implement a string table for ldconfig, with tail merging

Florian Weimer fweimer@redhat.com
Tue Nov 3 15:29:33 GMT 2020


* Adhemerval Zanella:

>>>> +struct stringtable_entry *
>>>> +stringtable_intern (struct stringtable *table, const char *string)
>>>> +{
>>>> +  if (table->allocated == 0)
>>>> +    stringtable_init (table);
>>>
>>> How this could happen? Is it expect the caller to set 'allocated'
>>> explicitly?
>> 
>> Zero-initialization is valid.  stringtable_free also leaves the table
>> ready for re-use.
>
> Wouldn't both usages make the above check unnecessary?

Doubling zero is still zero, so the growth code path doesn't work.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-alpha mailing list