]> pd.if.org Git - pdclib/blobdiff - functions/stdio/fclose.c
Improved testdrivers.
[pdclib] / functions / stdio / fclose.c
index 9ddff44de929f52442d3cdc3a967954fcd0373ca..0b4233034afe5b79b7fe0bccfa8b2c477e8b2654 100644 (file)
@@ -29,12 +29,13 @@ int fclose( struct _PDCLIB_file_t * stream )
             _PDCLIB_close( stream->handle );
             if ( previous != NULL )
             {
-                previous->next = current->next;
+                previous->next = stream->next;
             }
             else
             {
-                _PDCLIB_filelist = current->next;
+                _PDCLIB_filelist = stream->next;
             }
+            free( stream );
             return 0;
         }
         previous = current;