[Devel] [PATCH vz9] dm-ploop: fix a memory leak on destroy of ploop device

Alexander Atanasov alexander.atanasov at virtuozzo.com
Mon Apr 7 16:32:52 MSK 2025


mtfile array is allocated array of pointers to files
but it is leaked on device destroy, so free it.

https://virtuozzo.atlassian.net/browse/PSBM-160866
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/md/dm-ploop-target.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index f306f0c85ee5..de549f7633af 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -211,6 +211,7 @@ static void ploop_destroy(struct ploop *ploop)
 			if (ploop->deltas[ploop->nr_deltas].mtfile[i])
 				fput(ploop->deltas[ploop->nr_deltas].mtfile[i]);
 		}
+		kfree(ploop->deltas[ploop->nr_deltas].mtfile);
 	}
 	WARN_ON(ploop_has_pending_activity(ploop));
 	WARN_ON(!ploop_empty_htable(ploop->exclusive_pios));
-- 
2.43.0



More information about the Devel mailing list