aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-30 09:45:15 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-05-11 15:55:39 -0400
commit801f6f3fb6c7a87b689c4c4c478ebb62523931b5 (patch)
tree5f998ca6e2defeaa20339bbdb6d61f75446f50fb
parent8f91345c4284ed6c882c38e961be106e72418ec8 (diff)
downloadstasis-801f6f3fb6c7a87b689c4c4c478ebb62523931b5.tar.gz
init: clean up on error
-rw-r--r--src/lib/core/ini.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/core/ini.c b/src/lib/core/ini.c
index b4674e8..3c0377f 100644
--- a/src/lib/core/ini.c
+++ b/src/lib/core/ini.c
@@ -633,6 +633,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;
}
@@ -652,7 +653,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"))) {
@@ -660,7 +661,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);