stdio/fclose.c: reset _buf
- if the stream gets freopen()ed, avoid buffer being seen as valid
This commit is contained in:
parent
515e8d075f
commit
09569d399f
|
@ -25,6 +25,7 @@ fclose(FILE *fp)
|
||||||
if (_close(fileno(fp))) retval = EOF;
|
if (_close(fileno(fp))) retval = EOF;
|
||||||
if ( io_testflag(fp,_IOMYBUF) && fp->_buf )
|
if ( io_testflag(fp,_IOMYBUF) && fp->_buf )
|
||||||
free((void *)fp->_buf);
|
free((void *)fp->_buf);
|
||||||
|
fp->_buf = NULL;
|
||||||
if (fp != stdin && fp != stdout && fp != stderr)
|
if (fp != stdin && fp != stdout && fp != stderr)
|
||||||
free((void *)fp);
|
free((void *)fp);
|
||||||
return retval;
|
return retval;
|
||||||
|
|
Loading…
Reference in a new issue