From 080063920777af65105e5953e2851e036376e3ea Mon Sep 17 00:00:00 2001 From: Xianting Tian Date: Tue, 28 Dec 2021 11:09:24 +0800 Subject: [PATCH] vhost/test: fix memory leak of vhost virtqueues We need free the vqs in .release(), which are allocated in .open(). Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20211228030924.3468439-1-xianting.tian@linux.alibaba.com Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang --- drivers/vhost/test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index a09dedc..05740cb 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -166,6 +166,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) /* We do an extra flush before freeing memory, * since jobs can re-queue themselves. */ vhost_test_flush(n); + kfree(n->dev.vqs); kfree(n); return 0; } -- 2.7.4