This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH] memory leak in _reclaim_reent
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: newlib at sourceware dot org
- Date: Mon, 24 Jun 2013 13:34:17 +0200
- Subject: Re: [PATCH] memory leak in _reclaim_reent
- References: <BLU0-SMTP286299614CC6BC87C01382FF9890 at phx dot gbl> <20130624093636 dot GB14427 at calimero dot vinschen dot de> <BLU0-SMTP138AB67055744BB37EE5722F98A0 at phx dot gbl>
- Reply-to: newlib at sourceware dot org
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
> 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.
> 2013-06-24 Terraneo Federico <...>
> * libc/reent/reent.c (_reclaim_reent): Free also _misc and