diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-29 13:09:47 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-29 13:09:47 -0400 |
| commit | ef9d7bd1d819a908479e7c408da17242b64092e3 (patch) | |
| tree | 2547efb707066fba01b30523ca8cb23f9bb4d4eb /src/lib | |
| parent | 2356381b1b45d0a2e8244ffb5fb25b0d540b4c58 (diff) | |
| download | stasis-ef9d7bd1d819a908479e7c408da17242b64092e3.tar.gz | |
ini_section_create: reduce the pointer to something human readable
* free on error
Diffstat (limited to 'src/lib')
| -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 f90cb2b..9c332ca 100644 --- a/src/lib/core/ini.c +++ b/src/lib/core/ini.c @@ -407,13 +407,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; } |
