diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-29 13:09:47 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-05-11 15:50:48 -0400 |
| commit | df6ccdd5e534f175ba735247880c0d3b24b33bd4 (patch) | |
| tree | ea68dc578d8bdf7d644ee53fb023000126265aeb /src | |
| parent | e9ecb44bbd84c2896fcee35ead68baef9b8d1cc3 (diff) | |
| download | stasis-df6ccdd5e534f175ba735247880c0d3b24b33bd4.tar.gz | |
ini_section_create: reduce the pointer to something human readable
* free on error
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/core/ini.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/core/ini.c b/src/lib/core/ini.c index 07206ac..b761f4d 100644 --- a/src/lib/core/ini.c +++ b/src/lib/core/ini.c @@ -410,13 +410,15 @@ int ini_section_create(struct INIFILE **ini, char *key) { } (*ini)->section = tmp; - (*ini)->section[(*ini)->section_count] = calloc(1, sizeof(*(*ini)->section[0])); - if (!(*ini)->section[(*ini)->section_count]) { + struct INISection **section = &(*ini)->section[(*ini)->section_count]; + //[(*ini)->section_count]; + *section = calloc(1, sizeof(*(*ini)->section[0])); + if (!*section) { return -1; } - (*ini)->section[(*ini)->section_count]->key = strdup(key); - if (!(*ini)->section[(*ini)->section_count]->key) { + (*section)->key = strdup(key); + if (!(*section)->key) { return -1; } |
