[PATCH] stdio: Remove memory leak from multibyte convertion (BZ#25691)

Florian Weimer fw@deneb.enyo.de
Thu Mar 19 16:49:07 GMT 2020


* Adhemerval Zanella via Libc-alpha:

> On 19/03/2020 12:52, Florian Weimer wrote:
>> * Adhemerval Zanella via Libc-alpha:
>> 
>>> Both default and wide printf functions might leak memory when
>>> manipulate multibyte characters conversion depending of the size
>>> of the input (whether __libc_use_alloca trigger or not the fallback
>>> heap allocation).
>>>
>>> This patch fixes it by issuing the required memory free operation
>>> and also change the alloca/malloc strategy to a scratch buffer.
>>>
>>> The testcase uses input argument size that trigger memory leaks
>>> on unpatched code, using a scratch buffer the threashold to use
>>> heap allocation is lower.
>> 
>> Should we remove the malloc altogether?
>> 
>> I think we already have patches for that.
>> 
>
> Which malloc exactly (there are still some in printf) and which 
> patches are you referring ?

This seems to be it:

<https://sourceware.org/pipermail/libc-alpha/2017-June/082098.html>


More information about the Libc-alpha mailing list