Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-12-20 13:06:58 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-12-20 13:06:58 +0400
commit87865f4c9a6b629a054cd763d2baca7f8132c423 (patch)
tree4da32e0053bc221a3eaa1925a138283ebb27f23b /newlib/libc/stdio
parente7c65aae83d9872531cb3c7992364b115d8373e1 (diff)
* fvwrite.c (__sfvwrite_r): Set __SMBF flag to avoid double free in
fclose. Enhance comment.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/fvwrite.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c
index f196b3cfe..384c62ce0 100644
--- a/newlib/libc/stdio/fvwrite.c
+++ b/newlib/libc/stdio/fvwrite.c
@@ -155,8 +155,10 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio),
newsize);
if (!str)
{
- /* Free buffer which is no longer used. */
+ /* Free buffer which is no longer used and clear
+ __SMBF flag to avoid double free in fclose. */
_free_r (ptr, fp->_bf._base);
+ fp->_flags &= ~__SMBF;
/* Ensure correct errno, even if free changed it. */
ptr->_errno = ENOMEM;
goto err;