From: Michael Tremer Date: Mon, 14 Jun 2021 09:52:13 +0000 (+0000) Subject: config: Initialize entry with NULL before iteration X-Git-Tag: 0.9.28~1264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=467ef762f386f1774ccc080db5e719d1ed3dd3e4;p=pakfire.git config: Initialize entry with NULL before iteration Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/config.c b/src/libpakfire/config.c index b2df62df7..a231b4894 100644 --- a/src/libpakfire/config.c +++ b/src/libpakfire/config.c @@ -124,7 +124,7 @@ ERROR: static struct pakfire_config_entry* pakfire_config_find(struct pakfire_config* config, const char* section, const char* key) { - struct pakfire_config_entry* entry; + struct pakfire_config_entry* entry = NULL; // Check for valid input if (!key) { @@ -241,7 +241,7 @@ static int pakfire_section_in_sections(char** sections, const char* section) { } char** pakfire_config_sections(struct pakfire_config* config) { - struct pakfire_config_entry* entry; + struct pakfire_config_entry* entry = NULL; char** sections = NULL; size_t num_sections = 0; @@ -270,7 +270,7 @@ char** pakfire_config_sections(struct pakfire_config* config) { } int pakfire_config_has_section(struct pakfire_config* config, const char* section) { - struct pakfire_config_entry* entry; + struct pakfire_config_entry* entry = NULL; STAILQ_FOREACH(entry, &config->entries, nodes) { if (strcmp(entry->section, section) == 0)