]> arthur.barton.de Git - netdata.git/commitdiff
fixed mountinfo optional_fields code
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 29 Apr 2016 01:51:22 +0000 (04:51 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 29 Apr 2016 01:51:22 +0000 (04:51 +0300)
src/proc_self_mountinfo.c
src/proc_self_mountinfo.h

index ee29e20a26c9ee08bc272d2b3d90cf127f41d9e1..fa4079671612456f91af2739939bd71f514f7027 100644 (file)
@@ -56,11 +56,10 @@ void mountinfo_free(struct mountinfo *mi) {
        if(mi->optional_fields_count) {
                int i;
                for(i = 0; i < mi->optional_fields_count ; i++)
-                       free(mi->optional_fields[i]);
+                       free(*mi->optional_fields[i]);
        }
        free(mi->optional_fields);
 */
-
        free(mi->filesystem);
        free(mi->mount_source);
        free(mi->super_options);
@@ -147,7 +146,7 @@ struct mountinfo *mountinfo_read() {
 
                        int i;
                        for(i = 0; i < mi->optional_fields_count ; i++) {
-                               mi->optional_fields[wo] = strdup(procfile_lineword(ff, l, w));
+                               *mi->optional_fields[wo] = strdup(procfile_lineword(ff, l, w));
                                if(!mi->optional_fields[wo]) fatal("Cannot allocate memory");
                                wo++;
                        }
index d1056095ace365d111572de003e46f6c63f2711e..8c21274969c5885f698de7438c7925e7f025e012 100644 (file)
@@ -19,9 +19,8 @@ struct mountinfo {
 
        int optional_fields_count;
 /*
-       char *(*optional_fields); // optional fields: zero or more fields of the form "tag[:value]".
+       char ***optional_fields; // optional fields: zero or more fields of the form "tag[:value]".
 */
-
        char *filesystem;       // filesystem type: name of filesystem in the form "type[.subtype]".
        uint32_t filesystem_hash;