* fvwrite.c (__sfvwrite_r): Set __SMBF flag to avoid double free in
fclose. Enhance comment.
This commit is contained in:
parent
e7c65aae83
commit
87865f4c9a
|
@ -1,3 +1,8 @@
|
||||||
|
2011-12-20 Aleksandr Platonov <pam@oktetlabs.ru>
|
||||||
|
|
||||||
|
* fvwrite.c (__sfvwrite_r): Set __SMBF flag to avoid double free in
|
||||||
|
fclose. Enhance comment.
|
||||||
|
|
||||||
2011-12-19 Jeff Johnston <jjohnstn@redhat.com>
|
2011-12-19 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
* NEWS: Update with 1.20.0 info.
|
* NEWS: Update with 1.20.0 info.
|
||||||
|
|
|
@ -155,8 +155,10 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio),
|
||||||
newsize);
|
newsize);
|
||||||
if (!str)
|
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);
|
_free_r (ptr, fp->_bf._base);
|
||||||
|
fp->_flags &= ~__SMBF;
|
||||||
/* Ensure correct errno, even if free changed it. */
|
/* Ensure correct errno, even if free changed it. */
|
||||||
ptr->_errno = ENOMEM;
|
ptr->_errno = ENOMEM;
|
||||||
goto err;
|
goto err;
|
||||||
|
|
Loading…
Reference in New Issue