[PATCH v9] locale: memory leak in newlocale [BZ #25770]

Florian Weimer fweimer@redhat.com
Fri Jun 6 08:05:06 GMT 2025


* Dmitry Kovalenko:

> Hello,
>  
>> The first assert
>>
>> assert (locale_path_ptr != NULL);
>>
>> is not removed for some reason. This looks like a GCC bug to me. GCC
>> is generally able to determine that addresses on the stack cannot be
>> null.
>  
> I understood what you said )
>  
> I think for removing the such code «the global code optimization» is required.
>  
> Usually (as I understand) «the global code optimization» is used to
> build a final binaries where all debug checks already are removed )

I think it's possible with what we have today to do this because the
function is static and there are no extern calls before the null check.
GCC can do this this in simpler cases, probably it's some weird pass
ordering issue.

Thanks,
Florian



More information about the Libc-alpha mailing list