summaryrefslogtreecommitdiff
path: root/drivers/vhost
diff options
context:
space:
mode:
authorXianting Tian <xianting.tian@linux.alibaba.com>2021-12-28 11:09:24 +0800
committerMichael S. Tsirkin <mst@redhat.com>2022-01-14 18:50:53 -0500
commit080063920777af65105e5953e2851e036376e3ea (patch)
treed24d7534462d4fc56460e0786a156addaec3d2e0 /drivers/vhost
parent97143b70aa847f2b0a1f959dde126b76ff7b5376 (diff)
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 <xianting.tian@linux.alibaba.com> Link: https://lore.kernel.org/r/20211228030924.3468439-1-xianting.tian@linux.alibaba.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index a09dedc79f68..05740cba1cd8 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;
}