This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATH] Avoid double memory free if __sfvwrite_r() fails
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: newlib at sourceware dot org
- Date: Tue, 20 Dec 2011 10:07:33 +0100
- Subject: Re: [PATH] Avoid double memory free if __sfvwrite_r() fails
- References: <0255cd51989cadddb3018c4c4d565bea.squirrel@oktetlabs.ru>
- Reply-to: newlib at sourceware dot org
On Dec 20 12:33, Aleksandr Platonov wrote:
> Hi.
> fclose() function frees memory area pointed to by fp->_bf._base if __SMBF
> flag is set. But __sfvwrite_r() frees this memory area if _realloc_r()
> fails (see fvwrite.c, line 159) and does not clear __SMBF flag, so this
> memory area will be freed ones again at fclose() call.
Thanks for the patch. I applied it and added a few words to the
preceeding comment.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat