summaryrefslogtreecommitdiff
path: root/userland/libc/stdio/fclose.c
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/stdio/fclose.c')
-rw-r--r--userland/libc/stdio/fclose.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/userland/libc/stdio/fclose.c b/userland/libc/stdio/fclose.c
index 02d93ae..01bdb22 100644
--- a/userland/libc/stdio/fclose.c
+++ b/userland/libc/stdio/fclose.c
@@ -4,7 +4,8 @@
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html
// FIXME: Do some actual error checking.
int fclose(FILE *stream) {
+ if (stream)
free(stream->cookie);
- free(stream);
- return 0;
+ free(stream);
+ return 0;
}