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@xxxxxxxxxx> Signed-off-by: Li Xiao Keng <lixiaokeng@xxxxxxxxxx> --- mdadm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mdadm.c b/mdadm.c index 4685ad6b..19d7916b 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); -- 2.33.0