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>
This commit is contained in:
Xianting Tian 2021-12-28 11:09:24 +08:00 committed by Michael S. Tsirkin
parent 97143b70aa
commit 0800639207
1 changed files with 1 additions and 0 deletions

View File

@ -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;
}