cfgfile: fix uninitialized variable on load error
authorMichal Kobylinski <michalx.kobylinski@intel.com>
Wed, 13 Apr 2016 12:15:02 +0000 (14:15 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 2 May 2016 13:15:46 +0000 (15:15 +0200)
CID 13323:
Uninitialized scalar variable. Using uninitialized value
cfg->num_sections when calling rte_cfgfile_close.

Fixes: eaafbad419bf ("cfgfile: library to interpret config files")

Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
lib/librte_cfgfile/rte_cfgfile.c

index 75625a2..d72052a 100644 (file)
@@ -232,6 +232,7 @@ rte_cfgfile_load(const char *filename, int flags)
        return cfg;
 
 error1:
+       cfg->num_sections = curr_section + 1;
        rte_cfgfile_close(cfg);
 error2:
        fclose(f);