summaryrefslogtreecommitdiffstats
path: root/Settings.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-08-31 15:55:27 +1000
committerBenBE <BenBE@geshi.org>2021-08-31 08:08:01 +0200
commitb81bb9038c447559ca3d6295b351aa0c7d72eb54 (patch)
treebc5f26f31f3cf01a21c47cba3cb971d3931d9e0f /Settings.c
parent1f2f567ca1881ae7f01a99cb11b6810cbf897dae (diff)
Fix resource leaks dealing with unrecognised config file version
Plug leaks of an open file descriptor and dynamically allocated 'option' when we bail out early reading unknown config version.
Diffstat (limited to 'Settings.c')
-rw-r--r--Settings.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Settings.c b/Settings.c
index f4c79188..2786a829 100644
--- a/Settings.c
+++ b/Settings.c
@@ -182,6 +182,8 @@ static bool Settings_read(Settings* this, const char* fileName, unsigned int ini
// the version of the config file on disk is newer than what we can read
fprintf(stderr, "WARNING: %s specifies configuration format version v%d, but this %s binary supports up to v%d.", fileName, this->config_version, PACKAGE, CONFIG_READER_MIN_VERSION);
fprintf(stderr, " The configuration version will be downgraded to v%d when %s exits.\n", CONFIG_READER_MIN_VERSION, PACKAGE);
+ String_freeArray(option);
+ fclose(fd);
return false;
}
} else if (String_eq(option[0], "fields")) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy