]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-ddf.c
fix examine_brief segfault
[thirdparty/mdadm.git] / super-ddf.c
index 517a586420ae44130d46822bf2a03139803af115..8153924e16fd33d001f96dc91e3135b65e06fbdf 100644 (file)
@@ -762,6 +762,9 @@ static int load_ddf_local(int fd, struct ddf_super *super,
 static int load_super_ddf_all(struct supertype *st, int fd,
                              void **sbp, char *devname, int keep_fd);
 #endif
 static int load_super_ddf_all(struct supertype *st, int fd,
                              void **sbp, char *devname, int keep_fd);
 #endif
+
+static void free_super_ddf(struct supertype *st);
+
 static int load_super_ddf(struct supertype *st, int fd,
                          char *devname)
 {
 static int load_super_ddf(struct supertype *st, int fd,
                          char *devname)
 {
@@ -798,6 +801,8 @@ static int load_super_ddf(struct supertype *st, int fd,
                return 1;
        }
 
                return 1;
        }
 
+       free_super_ddf(st);
+
        if (posix_memalign((void**)&super, 512, sizeof(*super))!= 0) {
                fprintf(stderr, Name ": malloc of %zu failed.\n",
                        sizeof(*super));
        if (posix_memalign((void**)&super, 512, sizeof(*super))!= 0) {
                fprintf(stderr, Name ": malloc of %zu failed.\n",
                        sizeof(*super));