From 798f3aed35f8ee4102804620de84e947bbd9b8b8 Mon Sep 17 00:00:00 2001 From: cycl0ne Date: Mon, 9 Jun 2014 11:22:45 +0000 Subject: [PATCH] Memory leak on setvbuf. Since the buffer wasnt freed on fclose() --- functions/stdio/fclose.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/stdio/fclose.c b/functions/stdio/fclose.c index 9452413..bc8d852 100644 --- a/functions/stdio/fclose.c +++ b/functions/stdio/fclose.c @@ -55,6 +55,11 @@ int fclose( FILE * stream ) { remove( stream->filename ); } + /* Free user buffer (SetVBuf allocated) */ + if ( ! ( stream->status & _PDCLIB_FREEBUFFER ) ) + { + free( stream->buffer ); + } /* Free stream */ if ( ! ( stream->status & _PDCLIB_STATIC ) ) { -- 2.40.0