aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuanqin Miao <miaoguanqin@huawei.com>2023-04-24 16:06:37 +0800
committerJes Sorensen <jes@trained-monkey.org>2023-09-01 12:08:06 -0400
commite62a561ee8b7157a2390eab215dcef6240bd7b03 (patch)
tree256b7207c81a4181cd3721084a86783585d644a1
parentf6feb3fbb50f48c193e9e4d775a20aa20f7b47b3 (diff)
downloadmdadm-e62a561ee8b7157a2390eab215dcef6240bd7b03.tar.gz
Fix memory leak in file mdadm
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> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
-rw-r--r--mdadm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mdadm.c b/mdadm.c
index e32598cb..22d1c53b 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1708,6 +1708,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);