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