From: Owen Shepherd Date: Mon, 14 Jul 2014 15:40:14 +0000 (+0100) Subject: PDCLIB-26 #resolve fixed don't leak setvbuf allocated buffers X-Git-Url: https://pd.if.org/git/?a=commitdiff_plain;h=aacebf0b0209d7719b3cf34a022555fbcea924f3;hp=c83b63d8752d32b5fe82aa2b1c3b570eef531436;p=pdclib PDCLIB-26 #resolve fixed don't leak setvbuf allocated buffers --- 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 ) ) {