This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libio: Fix gconv-related memory leak [BZ #24583]


* Andreas Schwab:

> On Mai 20 2019, Florian Weimer <fweimer@redhat.com> wrote:
>
>> diff --git a/libio/iofclose.c b/libio/iofclose.c
>> index 8a80dd0b78..f4c7299db3 100644
>> --- a/libio/iofclose.c
>> +++ b/libio/iofclose.c
>> @@ -61,10 +61,10 @@ _IO_new_fclose (FILE *fp)
>>  	 the conversion functions.  */
>>        struct _IO_codecvt *cc = fp->_codecvt;
>>  
>> -      __libc_lock_lock (__gconv_lock);
>> -      __gconv_release_step (cc->__cd_in.__cd.__steps);
>> -      __gconv_release_step (cc->__cd_out.__cd.__steps);
>> -      __libc_lock_unlock (__gconv_lock);
>> +      __gconv_close_transform (cc->__cd_in.__cd.__steps,
>> +			       cc->__cd_in.__cd.__nsteps);
>> +      __gconv_close_transform (cc->__cd_out.__cd.__steps,
>> +			       cc->__cd_out.__cd.__nsteps);
>
> Are the __steps always allocated?  In get_gconv_fcts I see them being
> set to static data.

Correct, this needs to be handled differently.  It is difficult to
reproduce because the test framework disables the gconv cache (even when
running in a container).

I will try to fix the test framework first.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]