summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1998-01-07 00:12:04 +0000
committerimp <imp@FreeBSD.org>1998-01-07 00:12:04 +0000
commit683c0565d2607acaeb932b44ad8a624653b49c19 (patch)
treeaaa4379d41286cd8061f29a9d6521fc190e68975 /games
parent56d7e88ba1049fadc568dc6c2c2b850171c6bcae (diff)
downloadFreeBSD-src-683c0565d2607acaeb932b44ad8a624653b49c19.zip
FreeBSD-src-683c0565d2607acaeb932b44ad8a624653b49c19.tar.gz
Avoid fclose(NULL).
Submitted by: OpenBSD (Theo de Raadt)
Diffstat (limited to 'games')
-rw-r--r--games/phantasia/main.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/games/phantasia/main.c b/games/phantasia/main.c
index 3ed01dd..f412d09 100644
--- a/games/phantasia/main.c
+++ b/games/phantasia/main.c
@@ -1277,10 +1277,22 @@ bool doexit;
endwin();
}
- fclose(Playersfp);
- fclose(Monstfp);
- fclose(Messagefp);
- fclose(Energyvoidfp);
+ if (Playersfp) {
+ fclose(Playersfp);
+ Playersfp = NULL;
+ }
+ if (Monstfp) {
+ fclose(Monstfp);
+ Monstfp = NULL;
+ }
+ if (Messagefp) {
+ fclose(Messagefp);
+ Messagefp = NULL;
+ }
+ if (Energyvoidfp) {
+ fclose(Energyvoidfp);
+ Energyvoidfp = NULL;
+ }
if (doexit)
exit(0);
OpenPOWER on IntegriCloud