71 lines
2.4 KiB
Diff
71 lines
2.4 KiB
Diff
From f59ec61fa79001bd440d0bec32a59971efa2d032 Mon Sep 17 00:00:00 2001
|
|
From: David Teigland <teigland@redhat.com>
|
|
Date: Wed, 3 Apr 2024 17:54:48 -0500
|
|
Subject: [PATCH] lvmcache: fix memleaks on list removal
|
|
Reference:https://github.com/lvmteam/lvm2/commit/f59ec61fa79001bd440d0bec32a59971efa2d032
|
|
|
|
---
|
|
lib/cache/lvmcache.c | 16 ++++++++++++----
|
|
1 file changed, 12 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
|
|
index b8a9eac..2315d8e 100644
|
|
--- a/lib/cache/lvmcache.c
|
|
+++ b/lib/cache/lvmcache.c
|
|
@@ -912,8 +912,10 @@ next:
|
|
}
|
|
|
|
/* Remove dev_mpath from altdevs. */
|
|
- if ((devl = device_list_find_dev(&altdevs, dev_mpath)))
|
|
+ if ((devl = device_list_find_dev(&altdevs, dev_mpath))) {
|
|
dm_list_del(&devl->list);
|
|
+ free(devl);
|
|
+ }
|
|
|
|
/* Remove info from lvmcache that came from the component dev. */
|
|
log_debug("Ignoring multipath component %s with PVID %s (dropping info)", dev_name(dev_drop), pvid);
|
|
@@ -950,6 +952,7 @@ next:
|
|
|
|
log_debug("Ignoring multipath component %s with PVID %s (dropping duplicate)", dev_name(dev_drop), pvid);
|
|
dm_list_del(&devl->list);
|
|
+ free(devl);
|
|
|
|
cmd->filter->wipe(cmd, cmd->filter, dev_drop, NULL);
|
|
dev_drop->flags &= ~DEV_SCAN_FOUND_LABEL;
|
|
@@ -979,8 +982,10 @@ next:
|
|
}
|
|
|
|
/* Remove dev_md from altdevs. */
|
|
- if ((devl = device_list_find_dev(&altdevs, dev_md)))
|
|
+ if ((devl = device_list_find_dev(&altdevs, dev_md))) {
|
|
dm_list_del(&devl->list);
|
|
+ free(devl);
|
|
+ }
|
|
|
|
/* Remove info from lvmcache that came from the component dev. */
|
|
log_debug("Ignoring md component %s with PVID %s (dropping info)", dev_name(dev_drop), pvid);
|
|
@@ -1007,8 +1012,10 @@ next:
|
|
}
|
|
|
|
/* Remove dev_md from altdevs. */
|
|
- if ((devl = device_list_find_dev(&altdevs, dev_md)))
|
|
- dm_list_del(&devl->list);
|
|
+ if ((devl = device_list_find_dev(&altdevs, dev_md))) {
|
|
+ dm_list_del(&devl->list);
|
|
+ free(devl);
|
|
+ }
|
|
}
|
|
|
|
if (info && !dev_md) {
|
|
@@ -1036,6 +1043,7 @@ next:
|
|
|
|
log_debug("Ignoring md component %s with PVID %s (dropping duplicate)", dev_name(dev_drop), pvid);
|
|
dm_list_del(&devl->list);
|
|
+ free(devl);
|
|
|
|
cmd->filter->wipe(cmd, cmd->filter, dev_drop, NULL);
|
|
dev_drop->flags &= ~DEV_SCAN_FOUND_LABEL;
|
|
--
|
|
2.27.0
|
|
|