summaryrefslogtreecommitdiff
path: root/src/settingsgen/settingsgen.cpp
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2018-10-14 23:36:14 +0100
committerfrosch <github@elsenhans.name>2018-10-31 12:41:49 +0100
commitb5028efc1fa862073c908c435f84098ccd246fdc (patch)
treeec0a38f99b8885e4d977bb4e5ece8fd37d96a8e3 /src/settingsgen/settingsgen.cpp
parent52ed3bcbaa88717ab50f71150ed9fc0b6af4715a (diff)
downloadopenttd-b5028efc1fa862073c908c435f84098ccd246fdc.tar.xz
Fix: Protect against a few out of bounds or uninitialised usage errors
Diffstat (limited to 'src/settingsgen/settingsgen.cpp')
-rw-r--r--src/settingsgen/settingsgen.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp
index 44a3f6f26..ac6db6581 100644
--- a/src/settingsgen/settingsgen.cpp
+++ b/src/settingsgen/settingsgen.cpp
@@ -371,7 +371,10 @@ static bool CompareFiles(const char *n1, const char *n2)
if (f2 == NULL) return false;
FILE *f1 = fopen(n1, "rb");
- if (f1 == NULL) error("can't open %s", n1);
+ if (f1 == NULL) {
+ fclose(f2);
+ error("can't open %s", n1);
+ }
size_t l1, l2;
do {