diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-02-03 16:06:12 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-03-01 11:51:00 +0400 |
commit | 0c0eb30260b424d2a68603b89f1d829db18772c2 (patch) | |
tree | beed47ac4fdee819286926bb9a180be5d423a329 /tests/vhost-user-test.c | |
parent | fb6faea888c1e54059aed7f87be93de623b346ee (diff) |
tests: fix vhost-user-test leaks
Spotted by ASAN.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/vhost-user-test.c')
-rw-r--r-- | tests/vhost-user-test.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 2c45c7b29f..a61896c32d 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -139,6 +139,7 @@ enum { }; typedef struct TestServer { + QPCIBus *bus; gchar *socket_path; gchar *mig_path; gchar *chr_name; @@ -160,14 +161,13 @@ static const char *root; static void init_virtio_dev(TestServer *s) { - QPCIBus *bus; QVirtioPCIDevice *dev; uint32_t features; - bus = qpci_init_pc(NULL); - g_assert_nonnull(bus); + s->bus = qpci_init_pc(NULL); + g_assert_nonnull(s->bus); - dev = qvirtio_pci_device_find(bus, VIRTIO_ID_NET); + dev = qvirtio_pci_device_find(s->bus, VIRTIO_ID_NET); g_assert_nonnull(dev); qvirtio_pci_device_enable(dev); @@ -180,6 +180,7 @@ static void init_virtio_dev(TestServer *s) qvirtio_set_features(&dev->vdev, features); qvirtio_set_driver_ok(&dev->vdev); + qvirtio_pci_device_free(dev); } static void wait_for_fds(TestServer *s) @@ -507,6 +508,8 @@ static gboolean _test_server_free(TestServer *server) g_free(server->mig_path); g_free(server->chr_name); + qpci_free_pc(server->bus); + g_free(server); return FALSE; |