X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2Ffclose.c;h=c80e31d1a09f11e7ed56f2b6c25d48d8ff0657a9;hp=945241318afe09c8012d812412621ba50e13338c;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=0a419d48138f1411d6e3e50a367b9ece5a2cf893 diff --git a/functions/stdio/fclose.c b/functions/stdio/fclose.c index 9452413..c80e31d 100644 --- a/functions/stdio/fclose.c +++ b/functions/stdio/fclose.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* fclose( FILE * ) This file is part of the Public Domain C Library (PDCLib). @@ -11,7 +9,7 @@ #include #ifndef REGTEST -#include <_PDCLIB_io.h> +#include "_PDCLIB_io.h" #include extern FILE * _PDCLIB_filelist; @@ -55,6 +53,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 ) ) { @@ -73,7 +76,7 @@ int fclose( FILE * stream ) #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" int main( void ) {