diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2018-10-14 23:36:14 +0100 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2018-10-31 12:41:49 +0100 |
commit | b5028efc1fa862073c908c435f84098ccd246fdc (patch) | |
tree | ec0a38f99b8885e4d977bb4e5ece8fd37d96a8e3 /src/settingsgen/settingsgen.cpp | |
parent | 52ed3bcbaa88717ab50f71150ed9fc0b6af4715a (diff) | |
download | openttd-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.cpp | 5 |
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 { |