summaryrefslogtreecommitdiffstats
path: root/rogue
diff options
context:
space:
mode:
authorabs <abs@NetBSD.org>2006-03-17 23:04:01 +0000
committerabs <abs@NetBSD.org>2006-03-17 23:04:01 +0000
commit5eb45781ef17a15eed8ec8ecf03e20d8ad7f69cc (patch)
treead1becad8504773a3ebd500b4f3ef3c5356cf9a8 /rogue
parent751453a8ccc4c598a58e5b41868a6d9637b67474 (diff)
downloadbsdgames-darwin-5eb45781ef17a15eed8ec8ecf03e20d8ad7f69cc.tar.gz
bsdgames-darwin-5eb45781ef17a15eed8ec8ecf03e20d8ad7f69cc.tar.zst
bsdgames-darwin-5eb45781ef17a15eed8ec8ecf03e20d8ad7f69cc.zip
Call fclose() appropriately if there is a problem with the save file.
Coverty CID 2063
Diffstat (limited to 'rogue')
-rw-r--r--rogue/save.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/rogue/save.c b/rogue/save.c
index 8cbf4029..06e14b75 100644
--- a/rogue/save.c
+++ b/rogue/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.9 2003/08/07 09:37:40 agc Exp $ */
+/* $NetBSD: save.c,v 1.10 2006/03/17 23:04:01 abs Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.9 2003/08/07 09:37:40 agc Exp $");
+__RCSID("$NetBSD: save.c,v 1.10 2006/03/17 23:04:01 abs Exp $");
#endif
#endif /* not lint */
@@ -100,6 +100,8 @@ save_into_file(sfile)
}
if (((fp = fopen(sfile, "w")) == NULL) ||
((file_id = md_get_file_id(sfile)) == -1)) {
+ if (fp)
+ fclose(fp);
message("problem accessing the save file", 0);
return;
}