diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-30 09:45:15 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-30 09:45:15 -0400 |
| commit | b8bd5f4ad452991d2a3cf78517fcba86855236ec (patch) | |
| tree | cbfff19153eacd4971b7807150f4118d3f739b28 /src/lib | |
| parent | ac35ca7947fd83ba09efa06e0a723a33f8fa4d19 (diff) | |
| download | stasis-bughunt-1002.tar.gz | |
init: clean up on errorbughunt-1002
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/core/ini.c | 6 |
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); |
