From 09569d399f93acffa9b59d4bea584fabb1d497ce Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 2 Nov 2010 22:01:47 +0000 Subject: [PATCH] stdio/fclose.c: reset _buf - if the stream gets freopen()ed, avoid buffer being seen as valid --- lib/libc/stdio/fclose.c | 1 + 1 file changed, 1 insertion(+) 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; -- 2.44.0