@cryptotaxi247 / netdata-1 / commits / 03a34fd7f

fixed mountinfo optional_fields code

Costa Tsaousis (ktsaou) committed Apr 29, 2016 at 04:51 UTC 03a34fd7f710cfa38431403e14a296ea8d7a1e7c
2 files changed +3 -5
src/proc_self_mountinfo.c
+2 -3
@@ -56,11 +56,10 @@ void mountinfo_free(struct mountinfo *mi) {
56 if(mi->optional_fields_count) {
57 int i;
58 for(i = 0; i < mi->optional_fields_count ; i++)
59 - free(mi->optional_fields[i]);
59 + free(*mi->optional_fields[i]);
60 }
61 free(mi->optional_fields);
62 */
63 -
63 free(mi->filesystem);
64 free(mi->mount_source);
65 free(mi->super_options);
@@ -147,7 +146,7 @@ struct mountinfo *mountinfo_read() {
146
147 int i;
148 for(i = 0; i < mi->optional_fields_count ; i++) {
150 - mi->optional_fields[wo] = strdup(procfile_lineword(ff, l, w));
149 + *mi->optional_fields[wo] = strdup(procfile_lineword(ff, l, w));
150 if(!mi->optional_fields[wo]) fatal("Cannot allocate memory");
151 wo++;
152 }
src/proc_self_mountinfo.h
+1 -2
@@ -19,9 +19,8 @@ struct mountinfo {
19
20 int optional_fields_count;
21 /*
22 - char *(*optional_fields); // optional fields: zero or more fields of the form "tag[:value]".
22 + char ***optional_fields; // optional fields: zero or more fields of the form "tag[:value]".
23 */
24 -
24 char *filesystem; // filesystem type: name of filesystem in the form "type[.subtype]".
25 uint32_t filesystem_hash;
26