stdio/fclose.c: reset _buf

- if the stream gets freopen()ed, avoid buffer being seen as valid
This commit is contained in:
Ben Gras 2010-11-02 22:01:47 +00:00
parent 515e8d075f
commit 09569d399f

View file

@ -25,6 +25,7 @@ fclose(FILE *fp)
if (_close(fileno(fp))) retval = EOF;
if ( io_testflag(fp,_IOMYBUF) && fp->_buf )
free((void *)fp->_buf);
fp->_buf = NULL;
if (fp != stdin && fp != stdout && fp != stderr)
free((void *)fp);
return retval;