X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=blobdiff_plain;f=functions%2Fstdio%2Ffclose.c;h=0b4233034afe5b79b7fe0bccfa8b2c477e8b2654;hp=9ddff44de929f52442d3cdc3a967954fcd0373ca;hb=76aab9d24d750a2e639eb878d5907a8bcfab08cf;hpb=db7f305e7fb87e8f83bb59ef186671caef0f8449 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;