[PATCH] memory leak in _reclaim_reent
Corinna Vinschen
vinschen@redhat.com
Mon Jun 24 11:34:00 GMT 2013
On Jun 24 13:10, Federico Terraneo wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 06/24/2013 11:36 AM, Corinna Vinschen wrote:
> >
> > As far as I can see, destructing _sig_func needs synchronization.
> > If you free it, a _signal_r call could come in and access the
> > free'd memory. If it already has been set to NULL, _signal_r calls
> > _init_signal_r and reallocates it. So we either skip this problem
> > for now, or you have to make sure that nobody accesses _sig_func
> > during destruction.
> >
>
> Considering that on a second though the problem looks even worse
> (malloc isn't guaranteed to by signal-safe...), I opted for a simpler
> solution.
>
> This patch has two advantages:
> - - it fixes the leak about _signal_buf and _misc.
> - - it leaves a comment about the _sig_func issue being unsolved, which I
> presume is better than nothing.
>
> newlib/ChangeLog
> 2013-06-24 Terraneo Federico <...>
>
> * libc/reent/reent.c (_reclaim_reent): Free also _misc and
> _signal_buf.
Thanks, applied.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
More information about the Newlib
mailing list