aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 13:16:37 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 13:16:51 -0400
commit9946aa155696f908ff00e3dbcc5bb66be5664a64 (patch)
tree71fa3d9874076f892b00027b69b47ae8557c96ba /src
parent571e6f4f55a23357754c4b4ba269e20392966ac1 (diff)
downloadstasis-9946aa155696f908ff00e3dbcc5bb66be5664a64.tar.gz
ini_open: return on error
Diffstat (limited to 'src')
-rw-r--r--src/lib/core/ini.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lib/core/ini.c b/src/lib/core/ini.c
index 2cb0ee4..d4e6052 100644
--- a/src/lib/core/ini.c
+++ b/src/lib/core/ini.c
@@ -542,10 +542,19 @@ struct INIFILE *ini_open(const char *filename) {
return NULL;
}
- ini_section_init(&ini);
+ ini->section = ini_section_init(&ini);
+ if (!ini->section) {
+ ini_free(&ini);
+ return NULL;
+ }
// Create an implicit section. [default] does not need to be present in the INI config
- ini_section_create(&ini, "default");
+ if (ini_section_create(&ini, "default")) {
+ SYSERROR("%s", "unable to create default section");
+ ini_free(&ini);
+ ini = NULL;
+ return NULL;
+ }
strncpy(current_section, "default", sizeof(current_section) - 1);
current_section[sizeof(current_section) - 1] = '\0';
@@ -617,7 +626,11 @@ struct INIFILE *ini_open(const char *filename) {
// Create new named section
strip(section_name);
- ini_section_create(&ini, section_name);
+ if (ini_section_create(&ini, section_name)) {
+ SYSERROR("unable to create section: %s", section_name);
+ ini_free(&ini);
+ return NULL;
+ }
// Record the name of the section. This is used until another section is found.
memset(current_section, 0, sizeof(current_section));