From f99df06a920794c8075ec29e6202c6b7e4d982ef Mon Sep 17 00:00:00 2001 From: cenhuilin Date: Mon, 5 Aug 2024 15:02:20 +0800 Subject: [PATCH] config.c: Fix memory leak in load_containers() --- 0021-Fix-memory-leak-in-load_containers.patch | 28 +++++++++++++++++++ mdadm.spec | 6 +++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 0021-Fix-memory-leak-in-load_containers.patch diff --git a/0021-Fix-memory-leak-in-load_containers.patch b/0021-Fix-memory-leak-in-load_containers.patch new file mode 100644 index 0000000..fa196d6 --- /dev/null +++ b/0021-Fix-memory-leak-in-load_containers.patch @@ -0,0 +1,28 @@ +From 44457789fd67168c37932060f9a991f0c611e5a2 Mon Sep 17 00:00:00 2001 +From: Anna Sztukowska +Date: Mon, 5 Aug 2024 14:53:56 +0800 +Subject: [PATCH] config.c: Fix memory leak in load_containers() + +Fix memory leak in load_containers() in config.c reported by SAST +analysis. + +Signed-off-by: Anna Sztukowska +--- + config.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/config.c b/config.c +index 9c72545..7fc63dc 100644 +--- a/config.c ++++ b/config.c +@@ -188,6 +188,7 @@ struct mddev_dev *load_containers(void) + map = NULL; + } + free_mdstat(mdstat); ++ map_free(map); + + return rv; + } +-- +2.33.0 + diff --git a/mdadm.spec b/mdadm.spec index 50cc04c..5323512 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,6 +1,6 @@ Name: mdadm Version: 4.2 -Release: 17 +Release: 18 Summary: The software RAID arrays user manage tools License: GPLv2+ URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ @@ -30,6 +30,7 @@ Patch17: 0017-mdmon-fix-segfault.patch Patch18: 0018-fix-memory-leak-in-file-mdadm.patch Patch19: 0019-Fix-memory-leak-in-file-Manage.patch Patch20: 0020-Manage-fix-check-after-dereference-issue.patch +Patch21: 0021-Fix-memory-leak-in-load_containers.patch BuildRequires: systemd gcc binutils libudev-devel @@ -96,6 +97,9 @@ install -d -m 710 %{buildroot}/var/run/mdadm/ %{_mandir}/man*/* %changelog +* Mon Aug 5 2024 cenhuilin - 4.2-18 +- config.c: Fix memory leak in load_containers() + * Wed Jul 17 2024 wuguanghao - 4.2-17 - mdmonitor.service: add conditional judgment to avoid service startup failed -- Gitee