X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_cfgfile%2Frte_cfgfile.c;fp=lib%2Flibrte_cfgfile%2Frte_cfgfile.c;h=b81c2738c29ba7a74145a9021bc3a3a60796bc96;hb=d3e454a86f5f40fd66477fb032c3ce698795f18b;hp=f2bc2cc102887643f6da4a634422fcc82e0a12ef;hpb=8b27765d67604009e117476e66f6b9297e7c9e33;p=dpdk.git diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index f2bc2cc102..b81c2738c2 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -225,8 +225,10 @@ rte_cfgfile_load(const char *filename, int flags) } fclose(f); cfg->flags = flags; - cfg->sections[curr_section]->num_entries = curr_entry + 1; cfg->num_sections = curr_section + 1; + /* curr_section will still be -1 if we have an empty file */ + if (curr_section >= 0) + cfg->sections[curr_section]->num_entries = curr_entry + 1; return cfg; error1: