cfgfile: fix uninitialized variable on load error
authorDmitriy Yakovlev <bombermag@gmail.com>
Tue, 7 Feb 2017 02:51:06 +0000 (05:51 +0300)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 14 Feb 2017 17:13:48 +0000 (18:13 +0100)
commite7ee2ca1c9078b06ba64342ef8ce43a8022ec236
tree992ac03f134e5c7f0634150c301345179cb8da39
parent9375228852206c216ef7651461c1cc6e04ab8ebc
cfgfile: fix uninitialized variable on load error

Uninitialized scalar variable.
Using uninitialized value cfg->sections[curr_section]->num_entries
when calling rte_cfgfile_close.
And memory in variables cfg->sections[curr_section],
sect->entries[curr_entry] maybe not equal NULL.
We must decrement counters curr_section, curr_entry when failed to realloc.

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

Signed-off-by: Dmitriy Yakovlev <bombermag@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
lib/librte_cfgfile/rte_cfgfile.c