aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/core/ini.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/core/ini.c b/src/lib/core/ini.c
index 14c6875..a510327 100644
--- a/src/lib/core/ini.c
+++ b/src/lib/core/ini.c
@@ -616,6 +616,7 @@ struct INIFILE *ini_open(const char *filename) {
char *section_name = substring_between(line, "[]");
if (!section_name) {
fprintf(stderr, "error: invalid section syntax, line %zu: '%s'\n", i + 1, line);
+ ini_free(&ini);
return NULL;
}
@@ -629,6 +630,7 @@ struct INIFILE *ini_open(const char *filename) {
strip(section_name);
if (ini_section_create(&ini, section_name)) {
SYSERROR("unable to create section: %s", section_name);
+ guard_free(section_name);
ini_free(&ini);
return NULL;
}
@@ -648,7 +650,7 @@ struct INIFILE *ini_open(const char *filename) {
continue;
}
- char *operator = strchr(line, '=');
+ const char *operator = strchr(line, '=');
// a value continuation line
if (multiline_data && (startswith(line, " ") || startswith(line, "\t"))) {
@@ -656,7 +658,7 @@ struct INIFILE *ini_open(const char *filename) {
}
if (operator) {
- size_t key_len = operator - line;
+ const size_t key_len = operator - line;
memset(key, 0, key_size);
strncpy(key, line, key_len);