free_super_xx() should be executed at the load_super_xx() entry.
When there are additional checks, it may lead to supertype not being
released, resulting in a memory leak.
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
struct ddf_super *super;
int rv;
+ free_super_ddf(st);
+
if (get_dev_size(fd, devname, &dsize) == 0)
return 1;
return 1;
}
- free_super_ddf(st);
-
if (posix_memalign((void**)&super, 512, sizeof(*super))!= 0) {
pr_err("malloc of %zu failed.\n",
sizeof(*super));
int rv;
int retry;
+ free_super_imsm(st);
+
if (test_partition(fd))
/* IMSM not allowed on partitions */
return 1;
- free_super_imsm(st);
-
super = alloc_super();
if (!super)
return 1;