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