[PATCH 4/4] Fix memory leak in file mdadm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: miaoguanqin <miaoguanqin@xxxxxxxxxx>
Signed-off-by: lixiaokeng <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




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux