[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 26/33] tests: plug some leaks in virtio-net-test
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v6 26/33] tests: plug some leaks in virtio-net-test |
Date: |
Wed, 27 Jul 2016 01:15:20 +0400 |
From: Marc-André Lureau <address@hidden>
Found thanks to valgrind.
Signed-off-by: Marc-André Lureau <address@hidden>
---
tests/virtio-net-test.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
index a34a939..361506f 100644
--- a/tests/virtio-net-test.c
+++ b/tests/virtio-net-test.c
@@ -149,6 +149,7 @@ static void rx_stop_cont_test(const QVirtioBus *bus,
QVirtioDevice *dev,
char test[] = "TEST";
char buffer[64];
int len = htonl(sizeof(test));
+ QDict *rsp;
struct iovec iov[] = {
{
.iov_base = &len,
@@ -165,7 +166,8 @@ static void rx_stop_cont_test(const QVirtioBus *bus,
QVirtioDevice *dev,
free_head = qvirtqueue_add(vq, req_addr, 64, true, false);
qvirtqueue_kick(bus, dev, vq, free_head);
- qmp("{ 'execute' : 'stop'}");
+ rsp = qmp("{ 'execute' : 'stop'}");
+ QDECREF(rsp);
ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test));
g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len));
@@ -173,8 +175,10 @@ static void rx_stop_cont_test(const QVirtioBus *bus,
QVirtioDevice *dev,
/* We could check the status, but this command is more importantly to
* ensure the packet data gets queued in QEMU, before we do 'cont'.
*/
- qmp("{ 'execute' : 'query-status'}");
- qmp("{ 'execute' : 'cont'}");
+ rsp = qmp("{ 'execute' : 'query-status'}");
+ QDECREF(rsp);
+ rsp = qmp("{ 'execute' : 'cont'}");
+ QDECREF(rsp);
qvirtio_wait_queue_isr(bus, dev, vq, QVIRTIO_NET_TIMEOUT_US);
memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test));
@@ -230,8 +234,10 @@ static void pci_basic(gconstpointer data)
/* End test */
close(sv[0]);
qvirtqueue_cleanup(&qvirtio_pci, &tx->vq, alloc);
+ qvirtqueue_cleanup(&qvirtio_pci, &rx->vq, alloc);
pc_alloc_uninit(alloc);
qvirtio_pci_device_disable(dev);
+ g_free(dev->pdev);
g_free(dev);
qpci_free_pc(bus);
test_end();
--
2.9.0
- [Qemu-devel] [PATCH v6 16/33] vhost-user: check qemu_chr_fe_set_msgfds() return value, (continued)
- [Qemu-devel] [PATCH v6 16/33] vhost-user: check qemu_chr_fe_set_msgfds() return value, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 17/33] vhost-user: check vhost_user_{read, write}() return value, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 18/33] vhost-user: keep vhost_net after a disconnection, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 19/33] vhost-user: add get_vhost_net() assertions, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 20/33] Revert "vhost-net: do not crash if backend is not present", marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 21/33] vhost-net: vhost_migration_done is vhost-user specific, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 22/33] vhost: add assert() to check runtime behaviour, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 23/33] char: add chr_wait_connected callback, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 24/33] char: add and use tcp_chr_wait_connected, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 25/33] vhost-user: wait until backend init is completed, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 26/33] tests: plug some leaks in virtio-net-test,
marcandre . lureau <=
- [Qemu-devel] [PATCH v6 27/33] tests: fix vhost-user-test leak, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 29/33] tests: add a simple /vhost-user/multiqueue test, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 28/33] tests: add /vhost-user/connect-fail test, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 30/33] vhost-user: add error report in vhost_user_write(), marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 31/33] vhost: add vhost_net_set_backend(), marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 32/33] vhost-user-test: add flags mismatch test, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 33/33] RFC: vhost: do not update last avail idx on get_vring_base() failure, marcandre . lureau, 2016/07/26
- Re: [Qemu-devel] [PATCH v6 00/33] vhost-user reconnect fixes, Michael S. Tsirkin, 2016/07/28