diff options
author | Marc-André Lureau | 2017-02-07 13:55:14 +0100 |
---|---|---|
committer | Marc-André Lureau | 2017-03-01 08:58:57 +0100 |
commit | 80e1eea37a25a7696137e680285e36d0bfdc9f34 (patch) | |
tree | ddd94260713176d1eecf691881f3dba3d3fb6bcd /tests/libqos/virtio-pci.c | |
parent | tests: add specialized device_find function (diff) | |
download | qemu-80e1eea37a25a7696137e680285e36d0bfdc9f34.tar.gz qemu-80e1eea37a25a7696137e680285e36d0bfdc9f34.tar.xz qemu-80e1eea37a25a7696137e680285e36d0bfdc9f34.zip |
tests: fix virtio-blk-test leaks
Use qvirtio_pci_device_find_slot() to avoid leaking the non-hp
device. Add assert() to avoid further leaks in the future.
Use qvirtio_pci_device_free() to correctly free QVirtioPCIDevice.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/libqos/virtio-pci.c')
-rw-r--r-- | tests/libqos/virtio-pci.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c index 808365e8ca..7ac15c04e1 100644 --- a/tests/libqos/virtio-pci.c +++ b/tests/libqos/virtio-pci.c @@ -61,13 +61,14 @@ static void qvirtio_pci_foreach_callback( (!d->has_slot || vpcidev->pdev->devfn == d->slot << 3)) { d->func(&vpcidev->vdev, d->user_data); } else { - g_free(vpcidev); + qvirtio_pci_device_free(vpcidev); } } static void qvirtio_pci_assign_device(QVirtioDevice *d, void *data) { QVirtioPCIDevice **vpcidev = data; + assert(!*vpcidev); *vpcidev = (QVirtioPCIDevice *)d; } |