X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffclose.c;h=0b4233034afe5b79b7fe0bccfa8b2c477e8b2654;hb=76aab9d24d750a2e639eb878d5907a8bcfab08cf;hp=9ddff44de929f52442d3cdc3a967954fcd0373ca;hpb=22b64ead4cdb08b34e3db82fa1fb1c6095f6b0e9;p=pdclib.old diff --git a/functions/stdio/fclose.c b/functions/stdio/fclose.c index 9ddff44..0b42330 100644 --- a/functions/stdio/fclose.c +++ b/functions/stdio/fclose.c @@ -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;