From a38abf6ff0ba9329ac0fbc5bce6160d2706327f3 Mon Sep 17 00:00:00 2001 From: yanshuai01 Date: Thu, 24 Oct 2024 15:19:08 +0800 Subject: [PATCH] dmstats: Fix memory leak on error path --- ...mstats-Fix-memory-leak-on-error-path.patch | 25 +++++++++++++++++++ lvm2.spec | 6 ++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 0030-dmstats-Fix-memory-leak-on-error-path.patch diff --git a/0030-dmstats-Fix-memory-leak-on-error-path.patch b/0030-dmstats-Fix-memory-leak-on-error-path.patch new file mode 100644 index 0000000..6d0608d --- /dev/null +++ b/0030-dmstats-Fix-memory-leak-on-error-path.patch @@ -0,0 +1,25 @@ +From d1f0b89e65fd8817930bbf89051fe03efb0a1db5 Mon Sep 17 00:00:00 2001 +From: Marian Csontos +Date: Tue, 28 Nov 2023 21:41:35 +0100 +Subject: [PATCH] dmstats: Fix memory leak on error path + +--- + libdm/libdm-stats.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c +index 0401b83..037f275 100644 +--- a/libdm/libdm-stats.c ++++ b/libdm/libdm-stats.c +@@ -1968,7 +1968,7 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id, + (strlen(hist_arg)) ? HISTOGRAM_ARG : "", + hist_arg)) < 0) { + log_error(err_fmt, PRECISE_ARG " option."); +- return 0; ++ goto out; + } + } else + opt_args = dm_strdup(""); +-- +2.27.0 + diff --git a/lvm2.spec b/lvm2.spec index af90e5a..c438ce9 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.03.09 -Release: 19 +Release: 20 Epoch: 8 Summary: Tools for logical volume management License: GPLv2+ and LGPLv2.1 and BSD @@ -78,6 +78,7 @@ Patch26: 0026-dm-event-release-buffer-on-dm_event_get_version.patch patch27: 0027-clean-up-group-struct-in-_stats_create_group-error-path.patch Patch28: 0028-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch Patch29: 0029-use-4k-sector-size-when-any-dev-is-4k.patch +Patch30: 0030-dmstats-Fix-memory-leak-on-error-path.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -503,6 +504,9 @@ fi %changelog +* Wed Oct 23 2024 yanshuai - 8:2.03.09-20 +- dmstats: Fix memory leak on error path + * Thu Jun 06 2024 jinzhiguang - 8:2.03.09-19 - lvmlockd: use 4K sector size when any dev is 4K -- Gitee