Commit 08006392 authored by Xianting Tian's avatar Xianting Tian Committed by Michael S. Tsirkin
Browse files

vhost/test: fix memory leak of vhost virtqueues



We need free the vqs in .release(), which are allocated in .open().

Signed-off-by: default avatarXianting Tian <xianting.tian@linux.alibaba.com>
Link: https://lore.kernel.org/r/20211228030924.3468439-1-xianting.tian@linux.alibaba.com


Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
parent 97143b70
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
}