]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: Fix memory leak issue in check_raid()
authorWu Guanghao <wuguanghao3@huawei.com>
Tue, 14 Oct 2025 02:50:18 +0000 (10:50 +0800)
committerXiaoNi87 <xni@redhat.com>
Thu, 16 Oct 2025 14:02:02 +0000 (22:02 +0800)
check_raid() alloc for st, but did not release it when exiting.

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
util.c

diff --git a/util.c b/util.c
index 43d1c119d013a09b8445299bb56c19840ccdfef2..5d6fe800d6669d4404c1a41caa3ca62b6f9257f4 100644 (file)
--- a/util.c
+++ b/util.c
@@ -693,6 +693,8 @@ int check_raid(int fd, char *name)
                /* Looks like GPT or MBR */
                pr_err("partition table exists on %s\n", name);
        }
+
+       free(st);
        return 1;
 }