examples/ip_pipeline: move config files to separate directory
[dpdk.git] / lib / librte_cfgfile / rte_cfgfile.c
index f2bc2cc..a677dad 100644 (file)
@@ -92,7 +92,7 @@ rte_cfgfile_load(const char *filename, int flags)
        int allocated_entries = 0;
        int curr_section = -1;
        int curr_entry = -1;
-       char buffer[256];
+       char buffer[256] = {0};
        int lineno = 0;
        struct rte_cfgfile *cfg = NULL;
 
@@ -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: