]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: Fix memory leak issue in Manage_stop()
authorWu Guanghao <wuguanghao3@huawei.com>
Tue, 14 Oct 2025 03:29:37 +0000 (11:29 +0800)
committerXiaoNi87 <xni@redhat.com>
Thu, 16 Oct 2025 14:02:02 +0000 (22:02 +0800)
The local variable 'mds' allocated in Manage_stop() is only released
under specific conditions in the for loop. This can lead to memory leak
when under othe conditions.

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

index 22b1f52b7dc7ee49db97d73453c362830091c6b1..b53e65e9cea28f3d8f878a8c66f316c7ead3a991 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -286,6 +286,7 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
                                rv = 1;
                                goto out;
                        }
+               free_mdstat(mds);
        }
 
        /* If the array is undergoing a reshape which changes the number