From: Ben Gras Date: Tue, 2 Nov 2010 22:01:47 +0000 (+0000) Subject: stdio/fclose.c: reset _buf X-Git-Tag: v3.2.0~760 X-Git-Url: http://zhaoyanbai.com/repos/man.arpaname.html?a=commitdiff_plain;h=09569d399f93acffa9b59d4bea584fabb1d497ce;p=minix.git stdio/fclose.c: reset _buf - if the stream gets freopen()ed, avoid buffer being seen as valid --- diff --git a/lib/libc/stdio/fclose.c b/lib/libc/stdio/fclose.c index 56bd0ac4a..85ecb420a 100644 --- a/lib/libc/stdio/fclose.c +++ b/lib/libc/stdio/fclose.c @@ -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;