From ef9d7bd1d819a908479e7c408da17242b64092e3 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 29 Apr 2026 13:09:47 -0400 Subject: ini_section_create: reduce the pointer to something human readable * free on error --- src/lib/core/ini.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/lib') 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; } -- cgit