]> git.ipfire.org Git - pakfire.git/commitdiff
config: Initialize entry with NULL before iteration
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 09:52:13 +0000 (09:52 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 09:52:13 +0000 (09:52 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/config.c

index b2df62df70ee1bc7bf35327dca50413e6650eabe..a231b4894bdea87d98bb6aa95e3dc543008fb475 100644 (file)
@@ -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)