]> pd.if.org Git - pdclib/blobdiff - functions/stdio/fclose.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / stdio / fclose.c
index 945241318afe09c8012d812412621ba50e13338c..c80e31d1a09f11e7ed56f2b6c25d48d8ff0657a9 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* fclose( FILE * )
 
    This file is part of the Public Domain C Library (PDCLib).
@@ -11,7 +9,7 @@
 #include <errno.h>
 
 #ifndef REGTEST
-#include <_PDCLIB_io.h>
+#include "_PDCLIB_io.h"
 #include <threads.h>
 
 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 )
 {