aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/virtio.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2016-05-05 16:53:35 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2016-06-20 11:44:12 +0100
commitf1d3b99154138741161fc52f5a8c373bf71613c6 (patch)
tree9b8dc89292f0f64c6151601192a12c0805bc3047 /tests/libqos/virtio.c
parentc75f4c061bacad0c41708bf17d526fac72314ad0 (diff)
downloadqemu-f1d3b99154138741161fc52f5a8c373bf71613c6.zip
qemu-f1d3b99154138741161fc52f5a8c373bf71613c6.tar.gz
qemu-f1d3b99154138741161fc52f5a8c373bf71613c6.tar.bz2
libqos: add qvirtqueue_cleanup()
qvirtqueue_setup() allocates the vring and virtqueue state. So far there has been no function to free it. Callers have been using guest_free() for the vring but forgot to free the QVirtQueue state. This patch solves the memory leak by introducing qvirtqueue_cleanup(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/libqos/virtio.c')
-rw-r--r--tests/libqos/virtio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index f79d2d1..d8c2970 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -54,6 +54,12 @@ QVirtQueue *qvirtqueue_setup(const QVirtioBus *bus, QVirtioDevice *d,
return bus->virtqueue_setup(d, alloc, index);
}
+void qvirtqueue_cleanup(const QVirtioBus *bus, QVirtQueue *vq,
+ QGuestAllocator *alloc)
+{
+ return bus->virtqueue_cleanup(vq, alloc);
+}
+
void qvirtio_reset(const QVirtioBus *bus, QVirtioDevice *d)
{
bus->set_status(d, 0);