]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-ddf.c
mdadm: define DEV_MD_DIR
[thirdparty/mdadm.git] / super-ddf.c
index 309812dff61a0cc451dae47b3b1961ec38d1a394..7213284e0a596069c3a378e99094a19351a82b1f 100644 (file)
@@ -1592,15 +1592,20 @@ static unsigned int get_vd_num_of_subarray(struct supertype *st)
        sra = sysfs_read(-1, st->devnm, GET_VERSION);
        if (!sra || sra->array.major_version != -1 ||
            sra->array.minor_version != -2 ||
-           !is_subarray(sra->text_version))
+           !is_subarray(sra->text_version)) {
+               if (sra)
+                       sysfs_free(sra);
                return DDF_NOTFOUND;
+       }
 
        sub = strchr(sra->text_version + 1, '/');
        if (sub != NULL)
                vcnum = strtoul(sub + 1, &end, 10);
        if (sub == NULL || *sub == '\0' || *end != '\0' ||
-           vcnum >= be16_to_cpu(ddf->active->max_vd_entries))
+           vcnum >= be16_to_cpu(ddf->active->max_vd_entries)) {
+               sysfs_free(sra);
                return DDF_NOTFOUND;
+       }
 
        return vcnum;
 }
@@ -1643,7 +1648,7 @@ static void brief_examine_subarrays_ddf(struct supertype *st, int verbose)
                fname_from_uuid(st, &info, nbuf1, ':');
                _ddf_array_name(namebuf, ddf, i);
                printf("ARRAY%s%s container=%s member=%d UUID=%s\n",
-                      namebuf[0] == '\0' ? "" : " /dev/md/", namebuf,
+                      namebuf[0] == '\0' ? "" : " " DEV_MD_DIR, namebuf,
                       nbuf+5, i, nbuf1+5);
        }
 }