Message ID | 20230424080637.2152893-5-miaoguanqin@huawei.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Delegated to: | Jes Sorensen |
Headers | show |
Series | Fix memory leak for Manage Assemble Kill mdadm | expand |
On Mon, 24 Apr 2023 16:06:37 +0800 Guanqin Miao <miaoguanqin@huawei.com> wrote: > When we test mdadm with asan, we found some memory leaks in mdadm.c > We fix these memory leaks based on code logic. > > Signed-off-by: Guanqin Miao <miaoguanqin@huawei.com> > Signed-off-by: Li Xiao Keng <lixiaokeng@huawei.com> > --- Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
diff --git a/mdadm.c b/mdadm.c index 2296911d..409da62c 100644 --- a/mdadm.c +++ b/mdadm.c @@ -1709,6 +1709,10 @@ int main(int argc, char *argv[]) autodetect(); break; } + if (ss) { + ss->ss->free_super(ss); + free(ss); + } if (locked) cluster_release_dlmlock(); close_fd(&mdfd);